Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Uploading an image.

 
Dennis Lee
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic