commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Antwort: Re: Commons Upload: Can not read parameters if input type file is empty ...
Date Mon, 18 Oct 2010 07:06:07 GMT
Good Morning Jason,

thanks a lot. I will check the code.



Von:    Jason Britton <>
An:     Commons Users List <>
Datum:  15.10.2010 15:17
Betreff:        Re: Commons Upload: Can not read parameters if input type 
file is empty ...

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:

HIL Heeresinstandsetzungslogistik GmbH
Sitz Bonn
Amtsgericht-Registergericht-Bonn - HRB 13651
Geschäftsführer: Ulrich Frieling (Sprecher), Günter Schwarz
Aufsichtsratsvorsitzender: Willi Walgenbach

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message