• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Uploading images with jsp

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I trying to a HTML file which will let me choose 3 file and upload all of them at once.

There are also some text boxes.
<FORM METHOD=POST ENCTYPE="multipart/form-data" ACTION="FileUpload.jsp">
File to upload: <INPUT TYPE=FILE NAME="upfile1"><BR>
File to upload: <INPUT TYPE=FILE NAME="upfile2"><BR>
File to upload: <INPUT TYPE=FILE NAME="upfile3"><BR>
<INPUT TYPE=SUBMIT VALUE="Submit">

When subit is clicked the files should be stored on the server and the values in the text boxes should go to the db.I got the db part working[the easiest ]But I have no idea how to pass multiple images at once.

hOW CAN I handle this in upload.jsp
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See our FAQ on this subject:
http://faq.javaranch.com/java/FileUpload
 
sam barker
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the link.
I tried it but it giving me a NoClassDefFoundErrorexception.
But I had placed the 3 jar files inside WEB-INF/lib/



May 11, 2008 10:05:48 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:196)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:358)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at org.apache.jsp.FileUpload_jsp._jspService(FileUpload_jsp.java:74)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
sam barker
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,
Thanks a lot..I had download the commons.io. file..
Works like a charm
Cheers,
Jegan
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic