File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "a question about uploading an image...." Watch "a question about uploading an image...." New topic
Author

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
Author
Ranch Hand

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

Joined: Jan 10, 2002
Posts: 60752
    
  65

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.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Consider Paul's rocket mass heater.
 
subject: a question about uploading an image....
 
Similar Threads
Uploading an image to a server or to database?
how to add a GIF to show progress of upload and remove it once process is completed.
How to capture the Uploaded Image File into Servlet?
Uploading the Avatar using SSO
getParameter, getInputstream, getReader and uploading an image?