commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Duncan Lyall <>
Subject [FileUpload] Multiple exceptions causing confusion
Date Fri, 24 Feb 2006 09:04:25 GMT

I have been using commons-fileupload 1.0 for a while now with no problems.
I realise that there is a 1.1 out there but replacing the archive on my path results in a
load of deprecation warnings In MyEclipse and I really need to deal with one thing at a time
(deadlines you know).

The application is a prototype so I haven't worried too much about maximum file sizes etc.

Well now I do need to worry and I'm getting some odd behaviour

The following code exists in a Struts Action, I have no Action Form configured and I am parsing
the request myself.

This is not meant to be production strength code, obviously I will handle the exception properly
etc etc


   DiskFileUpload upload = new DiskFileUpload();
   upload.setSizeMax(ConfigServer.getMaxUploadSizeInBytes()); //set to 1MB at the moment
   List items = null;
      /* FileItem */ items = upload.parseRequest(request);
   catch(FileUploadBase.SizeLimitExceededException slee){
      return mapping.findForward("uploaderrors");
The odd thing is, when I attempt to upload a file larger that 1MB the Exception occurs twice
I know this because I get the String 'EXCEPTION' printed to the console twice, however I want
return	as soon as the Exception happens, I don't even know if this is a FileUpload issue or
Struts thing ...
There are three fields on the form (one file, one image(button) and one hidden) and the size
the file I'm trying to upload is 3.5 MB
Any ideas please ?


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

View raw message