File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes a question about uploading an image.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "a question about uploading an image...." Watch "a question about uploading an image...." New topic

a question about uploading an image....

Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
hey guys.. my question is this:
I have successfully developed a site in which a user can upload an image to the server. I'm using jspsmartupload and it's working fine..
now the requirement is: I must modify my form and allow a user to choose the image (browsing the local directory, and choosing the file). Once the user selects the image, I want it to be displayed on the right side of my form. This is without pressing the submit button .
It's like a preview-upload all-in-once. Is that possible to achieve?
any suggestion is highly apprecciated...

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Malhar Barai
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
hi dear
maybe u can use FRAMES/Javascript(to display the image)...
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

There really isn't any way to do that unless you go down the signed applet route. Remember that the page is composed on the server (including the reference to theimage in the img tag) and then sent to the client for rendering. Once on the client, (except in the case of a trusted client-side active component like an applet or activex control) you have no access to the file system of the client.
There are a number of tricks you could use to avoid page refresh in order to display the image (especially if you are not too concerned with legacy browsers), but you're going to have to upload the image first.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: a question about uploading an image....
It's not a secret anymore!