commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mart...@apache.org>
Subject Re: FileUpload: restrict upload file size for any file, not just for the wholerequest
Date Wed, 19 Nov 2003 19:04:22 GMT
Bugzilla #20838 is an existing enhancement request that I believe covers
what you are suggesting. Feel free to add yourself to the 'cc' list if
you'd like to be kept up to date with this.

With regard to the use of 'int' versus 'long', there was a reason for
that, related to what is actually available via the underlying Java API.
However, I don't recall the exact issue right now. Feel free to enter a
new enhancement request, if you like. That will ensure that it at least
gets explained somewhere. ;-)

--
Martin Cooper


On Wed, 19 Nov 2003 Steffi.Rauschenbach@bahn.de wrote:

> 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: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

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