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

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "FileUploadException" Watch "FileUploadException" New topic


Mini Pilla
Ranch Hand

Joined: Jul 15, 2001
Posts: 112
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(

ANy idea?? Any help is gretaly appreciate. My google search is exhausted!!!
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

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
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:
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/, application/, 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

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

Joined: Nov 02, 2004
Posts: 1

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 shows how to upload using the file kept in memory.


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 :

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(...);
// that is so easy !!

else {
InputStream uploadedStream = item.getInputStream();

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

thanks for your support (and please forgive my frenchie english)
Don't get me started about those stupid light bulbs.
subject: FileUploadException