• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to upload image file through jsp to the server  RSS feed

 
sanat meher
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Can anybody tell me how to upload a file using jsp.I m trying to upload one image file using <input type="file" name="file" id="button6" value="Browse" />
and submitting the form to upload page.jsp where i m retriving the submitted path value using request.getParameter("file") and then storing it onto database.but when I upload using <file> tag, it's does not upload file from client machine but only from server machine ... So I just only got no file found error(IOexception file not found). ... How should I do?

The code for uploadpage.jsp is as follows:




Could anyone help me out how to resolve this issue.

Thanks,
Sanat
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do not use JSP for this, it is receipt for trouble.
You should use multipart/form-data enctype.
Files are not to be obtained as request parameter, but as request body.

Use Apache Commons FileUpload API. Start at their homepage. Read both the User Guide and Frequently Asked Questions sections.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JSP FAQ for more information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!