aspose file tools*
The moose likes Servlets and the fly likes FileUploadException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "FileUploadException" Watch "FileUploadException" New topic
Author

FileUploadException

Mini Pilla
Ranch Hand

Joined: Jul 15, 2001
Posts: 112
Hi,
I ma getting this error when uploading a file
apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly(at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java).

ANy idea?? Any help is gretaly appreciate. My google search is exhausted!!!
Thanks
Rajani
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
any code snippet??

I would like to refer you to this. Its better to just upload a file in a simpler manner then go for something complex.

TIP: try to upload any small file first
[ October 12, 2004: Message edited by: adeel ansari ]
Rahul kapoor
Greenhorn

Joined: Sep 21, 2004
Posts: 16
Can you post the stackTrace of the exception.

Are you trying to upload a a file whose size is larger than the value specified in the code ( usually ppl keep it around 10 MB)?
Mini Pilla
Ranch Hand

Joined: Jul 15, 2001
Posts: 112
Hi,
I am using jakarata common upload functions. I am able to upload file when I am doing from browser. In my application, .net client is trying to upload to Jboss. .net client is webclient.

Error : org.apache.commons.fileupload.FileUploadException: Processing of
multipart/form-data request failed. Stream ended unexpectedly.

I even tried to echo the request....and this is what i got..
Here is the request line and request headers sent by your browser:
POST / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Referer: http://localhost:8080/examples/jsp/BrowsePage.jsp
Accept-Language: en-us
Content-Type: multipart/form-data; boundary=---------------------------7d41112770e48
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
Host: localhost:8088
Content-Length: 643
Connection: Keep-Alive
Cache-Control: no-cache

-----------------------------7d41112770e48
Content-Disposition: form-data; name="xpdl"; filename="C:\boot.ini"
Content-Type: application/octet-stream



In my opinion,its is somethign to do with boundary......I did everyhitng....i increased the threashold size in my servlet but of no use

Thanks for the help....
julien ramel
Greenhorn

Joined: Nov 02, 2004
Posts: 1
Hello,

I've been trying since this morning to use the "jakarta apache" upload file.

I could very easely upload file on my server, change the file name and path, however, I really don't understant how to directly write the file on the disk, the basic example http://jakarta.apache.org/commons/fileupload/using.html shows how to upload using the file kept in memory.

but

now it's 3 hours that I'm trying to understand how to setup the max memory size and use the alternative way to write the file directly on the disk, of course, it was easy to set the size :
upload.setSizeThreshold(maxMemorySize);

but all I get is a servlet exeption telling me that the file is too large.
of course I know that, but how can I do something about is ?

i mean
if (item.isInMemory() ){ // the file size is under my "maxMemorySize"
// do the regular file upload from memory
// easy, I just followed the example in jakarta website
}
else {

// my file is too large, I cannot overload the server, need to write on the temp folder ( defined with setRepositoryPath("/tmp/");
// how can I do that ??
// I can understand some javaDoc, but I'm not an engeneer, really need some sample code to see how it's working

}

If anyone could give me a link to a more precise sample page than on the jakarta help files...

really frustrating to only have


// Process a file upload
if (writeToFile) {
File uploadedFile = new File(...);
item.write(uploadedFile);
}
// that is so easy !!

else {
InputStream uploadedStream = item.getInputStream();
...
uploadedStream.close();
}


what to do instead of the " ... " ???


thanks for your support (and please forgive my frenchie english)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FileUploadException