Hi, I'm trying to use MultipartRequest to upload a file. When I get to the servlet, I get: java.lang.IllegalArgumentException: Not a directory: /images at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:211) at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:106) at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:86) at testPad.Uploader.doPost(Uploader.java:19)........
The MultipartRequest object in the servlet is instantiated thusly: MultipartRequest mpRequest = new MultipartRequest(request,"/images");
I also tried it without the slash, but the results were the same. Finally, this is my directory structure:
Can anyone help me correct this? Thanks! g. [ August 08, 2002: Message edited by: Garann Rose Means ]
Well , what I feel here there is no way u can achieve this fuctionality without modifying the MultipartRequest.java file . So what u can do is inside the constructor of MultipartRequest file u can check for the file type or ur condition on which u want to put ur file in the respective directory and make the call to its other constructor which takes 2 parameters and can set the direcory also .
Try and Try Till u succeed<br /> <br />Sandeep Jain
Joined: Oct 25, 2000
Sorry , I just enter the comments in the wrong window, they were answer to some other question so please do not bother . What u can try out here is give the absolute path of the directory .
Joined: Jan 28, 2002
I ended up just sending an email to the contact address listed on the servlets.com website. Jason Hunter responded:
It can be either (relative or absolute -g.). If relative it's relative to the current directory of the web server process. Save a "foo.txt" and you'll see where that is, or you'll get an error msg since it's very likely unwritable on Unix.
..In case anyone else was wondering the same thing. g.
MultipartRequest(javax.servlet.http.HttpServletRequest request, java.lang.String saveDirectory) Constructs a new MultipartRequest to handle the specified request, saving any uploaded files to the given directory, and limiting the upload size to 1 Megabyte.