This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes File upload to a user defined directory Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "File upload to a user defined directory" Watch "File upload to a user defined directory" New topic
Author

File upload to a user defined directory

arjun rao
Greenhorn

Joined: Jun 15, 2001
Posts: 1
Hi
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())
{
if(name.equals("path"))
{
ParamPart paramPart = (ParamPart) part;
value = paramPart.getStringValue();
printWriter.println(value);
}
}
}
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
(newrequest,value,1024*1024);
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: File upload to a user defined directory
 
Similar Threads
com.oreilly.servlet problem
request.getParameterValues not working
File field content
Upload/download file
Upload using O'Reilly package