jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes File upload to a user defined directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "File upload to a user defined directory" Watch "File upload to a user defined directory" New topic

File upload to a user defined directory

arjun rao

Joined: Jun 15, 2001
Posts: 1
I am usnig the orilley package to upload a file to a directory secified by a user in the HTML form.
I get the user defined directory by using the Maltipart parser as follows
MultipartParser parser = new MultipartParser(newrequest, 1024*1024);
Part part;
while ((part = parser.readNextPart()) != null)
name = part.getName();
if (part.isParam())
ParamPart paramPart = (ParamPart) part;
value = paramPart.getStringValue();
newrequest is a copy of the InputStream of the Servlet
HttpServletRequest newrequest = request;
Then i am using the MultipartRequestobject to upload the file as follows.
MultipartRequest defaultupload=new MultipartRequest
This gives me an exception as follows
Corrupt form data: premature ending
Can someone please explain how i can overcome this problem
I agree. Here's the link: http://aspose.com/file-tools
subject: File upload to a user defined directory
It's not a secret anymore!