commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Louis Marascio" <>
Subject [FileUpload] Cleaning up temporary files if uploads are aborted
Date Mon, 01 Jan 2007 04:12:01 GMT

I'm tinkering with FileUpload v1.1.1 and have the basic upload
working.  I noticed that if, during an upload, I click the stop button
in my browser the upload is aborted on the server side appropriately
w/ an exception. However, the temporary file that was being written by
the DiskFileItem is not being cleaned up in this situation. I can't
clean it up from my servlet handler since the FileItem was never added
to the collection, etc. It appears to be a trivial fix in
FileUploadBase.parseRequest().  Move the declaration of FileItem
outside of the try/catch, and, in the catch method do something along
the lines of:

if (item != null) item.delete();

I can submit a patch if desired.  I checked subversion to see how much
parseRequest() has changed and it appears to have been significantly
altered.  I'm not sure if there is much value submitting the patch
against 1.1.1 if a new release is imminent.

Am I missing something here? Is there some other way to get these
temporary files cleaned up in the case of an aborted or failed upload?



Louis R. Marascio

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

View raw message