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 finished
and then only process files that are below the max file size; and drop all
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 size)
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 (runtime
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 had
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 >> http://www.bahn.de

---------

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 you
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to