commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schalk" <>
Subject RE: FileUpload: restrict upload file size for any file, not just for the wholerequest
Date Wed, 19 Nov 2003 18:20:19 GMT
I would recommend submitting this as a future enhancement request, or
develop a add-on and submit it for inclusion in the next release.

Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.CEO
Tel: +27125468436
Fax: +27125468436
This message contains information that is considered to be sensitive or
confidential and may not be forwarded or disclosed to any other party
without the permission of the sender. If you received this message in error,
please notify me immediately so that I can correct and delete the original
email. Thank you. 

:: -----Original Message-----
:: From: []
:: Sent: Wednesday, November 19, 2003 7:08 PM
:: To:
:: Subject: FileUpload: restrict upload file size for any file, not just for
the wholerequest
:: Hi,
:: we want to restrict the size of each *file* that is getting uploaded to
:: some maximum file size. The FileUpload lib only allows to set a maximum
:: *request* size.
:: Of course, I could use item.getSize() after the upload/parsing has
:: and then only process files that are below the max file size; and drop
:: other files. However, we don't even want to upload files that are too
:: large. That is, we want to stop uploading a file when it turns out to be
:: larger than allowed and go on with the next file.
:: FileUpload contains a class ThresholdingOutputStream that can be used to
:: implement a stream that counts the bytes that are getting uploaded, i.e.
:: written to the output stream, and reacts when the threshold (max file
:: is reached.
:: So I just have to throw some exception in the implementation of the
:: abstract method thresholdReached() of ThresholdingOutputStream.
:: The problem is that in FileUploadBase::parseRequest(...), where this
:: exceptions ends up, there is no exception handling for exceptions
:: exceptions) that disallow processing of just *one* file item, not of the
:: *whole* request.
:: Thus, without patching FileUploadBase, I cannot restrict the size on a
:: per-file-basis.
:: Also, it would be helpful if the threshold in ThresholdingOutputStream
:: type long instead of type int - for large file sizes... :-)
:: Would these be reasonable changes to the file upload lib?
:: Thanks,
:: Steffi
:: ____________________________________________________
:: Internetauftritt der Deutschen Bahn AG >>
:: ---------
:: Diese E-Mail könnte  vertrauliche und/oder rechtlich geschützte
:: Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder
:: diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
:: Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
:: unbefugte Weitergabe dieser Mail sind nicht gestattet.
:: This e-mail may contain confidential and/or privileged information. If
:: are not the intended recipient (or have received this e-mail in error)
:: please notify the sender immediately and destroy this e-mail. Any
:: unauthorised copying, disclosure or distribution of the material in this
:: e-mail is strictly forbidden.
:: ----------
:: ---------------------------------------------------------------------
:: To unsubscribe, e-mail:
:: For additional commands, e-mail:

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

View raw message