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

MultipartRequest class

 
fahim chowdhury
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know where I can find a functional MultipartRequest class? I tried using the one from the OReilly book, but it seems to have bugs.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried the file available from their website? Perhaps the copy that came with your book is flawed and a new version is available.
Otherwise, a quick search on google turns up lots of hits.
 
Conie Ooi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can download the classes from http://www.servlets.com/cos/index.html
 
fahim chowdhury
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I am using the MultipartRequest class from the oreilly site, but I still have an error when I try to utilize the class. I put the MultipartRequest class file in the same folder as the servlet that calls its constructor. Here is the error:
C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEBINF\classes\com\oreilly\servlet\uploadservlet.java:17: cannot access MultipartRequest
bad class file: C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\com\oreilly\servlet\MultipartRequest.class
class file contains wrong class: com.oreilly.servlet.MultipartRequest
Please remove or make sure it appears in the correct subdirectory of the classpath.
MultipartRequest request = new MultipartRequest(req,"MyUploads\test");
^
1 error
Process completed.
 
Juanjo Bazan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best way for using the class is including the jar file in the WEB-INF/lib directory.
You dont need to put the servlet which calls the constructor in the same dir.
Anyway, make sure you have in the classpath not only the MultipartRequest class, but the complete package or at least the other classes used by MultipartReques class (like MultipartParser, Part FilePart, ParamPart, FileRenamePolicy, etc...)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic