| Author |
MultipartRequest syntax question
|
Garann Means
Ranch Hand
Joined: Jan 28, 2002
Posts: 214
|
|
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 ]
|
 |
Sandeep Jain
Ranch Hand
Joined: Oct 25, 2000
Posts: 124
|
|
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
|
 |
Sandeep Jain
Ranch Hand
Joined: Oct 25, 2000
Posts: 124
|
|
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 .
|
 |
Garann Means
Ranch Hand
Joined: Jan 28, 2002
Posts: 214
|
|
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.
|
 |
Malhar Barai
Author
Ranch Hand
Joined: Aug 17, 2001
Posts: 399
|
|
MultipartRequest mpRequest = new MultipartRequest(request,"/images");
dear what i can think is MultipartRequest doesnt hv a constructor with 2 arguments viz. (Request,PATH), make such a contstructor in Java file & then try using it... HTH malhar
|
 |
Garann Means
Ranch Hand
Joined: Jan 28, 2002
Posts: 214
|
|
Malhar, Check the JavaDoc. The first constructor is
Thanks anyway. g.
|
 |
 |
|
|
subject: MultipartRequest syntax question
|
|
|