/    Sign up×
Community /Pin to ProfileBookmark

view upload image

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?

to post a comment
Full-stack Developer

8 Comments(s)

Copy linkTweet thisAlerts:
@pyroOct 01.2003 — 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?
Copy linkTweet thisAlerts:
@kanuskiauthorOct 01.2003 — 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.
Copy linkTweet thisAlerts:
@pyroOct 01.2003 — I don't think it can be done with JavaScript (for security reasons) but it possibly could be done with ActiveX...
Copy linkTweet thisAlerts:
@PeOfEoOct 03.2003 — 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?
Copy linkTweet thisAlerts:
@pyroOct 03.2003 — Yes, except I'm fairly certain that for security reasons, JavaScript can not read values out of an <input type="file"> tag...
Copy linkTweet thisAlerts:
@James_L_Oct 03.2003 — 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.
Copy linkTweet thisAlerts:
@pyroOct 03.2003 — 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...
Copy linkTweet thisAlerts:
@PeOfEoOct 03.2003 — 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.
×

Success!

Help @kanuski spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...