commons-user mailing list archives

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

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
whole
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

...

if(FileUpload.isMultipartContent(request)){
    		
   DiskFileUpload upload = new DiskFileUpload();
   upload.setSizeMax(ConfigServer.getMaxUploadSizeInBytes()); //set to 1MB at the moment
   List items = null;
   try{
      /* FileItem */ items = upload.parseRequest(request);
   }
   catch(FileUploadBase.SizeLimitExceededException slee){
      System.out.println("EXCEPTION");
      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
to
return	as soon as the Exception happens, I don't even know if this is a FileUpload issue or
a
Struts thing ...
	
There are three fields on the form (one file, one image(button) and one hidden) and the size
of
the file I'm trying to upload is 3.5 MB
	
Any ideas please ?

Cheers
Duncan 
			

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message