commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Britton <>
Subject Re: Commons Upload: Can not read parameters if input type file is empty ...
Date Fri, 15 Oct 2010 13:17:02 GMT
Before you call parseRequest I would first check to make sure you're
dealing with a multipart post - in cases when you're not uploading a
file calling parseRequest may not be the right way to go and that
exception being thrown is FileUpload's way of telling you, hey I don't
see any file data to handle thus the  "Stream ended unexpectedly".
That's my best guess.  Try something like this

// Check that we have a file upload request
boolean isMultipart = ServletFileUpload.isMultipartContent(request);

if (isMultipart) {
    // do your parseRequest here since you know they uploaded a file
} else {
    // no file uploaded this time, try retrieving non-file form
parameter values old fashioned way, request.getParameter("foo") etc...

// operate on retrieved form data here

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message