This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes 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 "Uploading an image." Watch "Uploading an image." New topic
Author

Uploading an image.

Dennis Lee
Greenhorn

Joined: Dec 03, 2001
Posts: 7
Hi all,
I want to upload an image to the web-server automatically because I use applet to get the image from scanner. Originally I wanted to save the image to disk and call javascript from applet to set the "File" attribute and post, but the "File" is read-only and only change when user browse and choose the file. How could I upload the image automatically by post of jsp or by applet?(besides the image, I also have some other hidden parameters in jsp to post together).
Hope you could help me. Thanks.
deepu
Greenhorn

Joined: Jan 18, 2002
Posts: 1
hi you have to use multipart concept for that you better to check in orielly.you should have client like this.
and multipat code is avilable for free download in orielly site
<html>
<head>
</head>
<body>
<FORM METHOD=post ACTION="SaveFile.jsp" ENCTYPE="multipart/form-data">
<INPUT TYPE=file NAME=image ACCEPT="image/gif">
<INPUT TYPE=submit VALUE="Submit">
<INPUT TYPE=reset VALUE="Reset Form">
</FORM>
</body>
</html>
++++++
removed wholesale quote -MC
[ January 22, 2002: Message edited by: Mike Curwen ]
Dennis Lee
Greenhorn

Joined: Dec 03, 2001
Posts: 7
Maybe my question was not so clear just now.
What I want is no need for user to choose file, the jsp or applet could send the image to server automatically.
The jsp you provided should let the user to choose file. That is not my need.
 
Consider Paul's rocket mass heater.
 
subject: Uploading an image.
 
Similar Threads
JSP uploader
could i prepare JMS for tranfer wav file?
Writing Image from Applet
How to upload only image file
applet within browser not releasing file resource