Click to See Complete Forum and Search --> : view upload image


kanuski
10-01-2003, 01:08 AM
I am using an html form and php to allow users to upload jpg's to the webserver. When a jpg has been selected I would like to display it on the same page. Is there a server-side programing langauge that will do this?

pyro
10-01-2003, 08:31 AM
Depends what you mean. Do you mean when it has been uploaded from their computer, or are you talking about making a "preview" so to speak, for the images before they are uploaded?

kanuski
10-01-2003, 09:54 AM
My mistake. I meant a client-side script so I can have a preview of the image on the same page. Users can then add other data for the image before uploading.

pyro
10-01-2003, 11:13 AM
I don't think it can be done with JavaScript (for security reasons) but it possibly could be done with ActiveX...

PeOfEo
10-02-2003, 10:50 PM
what if after the image were selected you populate an <img src tag dynamically. You could use an html <input file or something with get the path from that and then use java script to fill the img src. Sound plausable?

pyro
10-02-2003, 10:55 PM
Yes, except I'm fairly certain that for security reasons, JavaScript can not read values out of an <input type="file"> tag...

James L.
10-03-2003, 12:31 PM
I think Pyro is right. If you used an ActiveX to do it, would that not be restricted to IE though?

I'm not too familiar with the ActiveX controls.

pyro
10-03-2003, 02:22 PM
Yes, it would be restricted to IE, and I'm guessing most users have it set to the default setting for ActiveX (disabled for scripts not marked as safe, disabled for unsigned, prompt for signed), which is pretty limited...

PeOfEo
10-03-2003, 06:07 PM
If you cant do it client site do it with a server side langange, upload it as a temporary file (Extra code may be needed to overright depending on the server and language) and then populate the <img> tag on change of the input type="file"> It will cause the page to refresh but it will not be browser specific.