File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes commons-fileupload problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "commons-fileupload problem" Watch "commons-fileupload problem" New topic

commons-fileupload problem

Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
I am using commons fileupload and am getting the following error when I try to upload a file larger than 50KB:

org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly
at org.apache.commons.fileupload.FileUploadBase.parseRequest(

using the following code:

// Create a new file upload handler
DiskFileUpload upload = new DiskFileUpload();

// Set upload parameters
upload.setSizeThreshold( 5*1024 );
upload.setSizeMax( this.getMaxUploadSize() );
upload.setRepositoryPath( application.getRealPath( getSetting( "upload_path" ) ) );

// Parse the request ( Throwing the error )
List items = upload.parseRequest( request );
SCJP 1.4
Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
a 56KB file throws the error, but a 54 KB file does not.

I think it has something to do with the whole request not being received, however I am accessing over a network connection so it should be fast, I can only imagine what it will be like once I post to a production server.

btw, the max upload is set to 10MB, so that is not the problem.
[ April 05, 2005: Message edited by: Kerry Wilson ]
Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
jk2 connector has a bug in it. Fixed it by turning logging to DEBUG in the file. If anyone has a real fix, let me know.
I agree. Here's the link:
subject: commons-fileupload problem
It's not a secret anymore!