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] File Size Limit Exceeded - Any method for early detection?
Date Tue, 05 Oct 2010 04:56:11 GMT
On Mon, Oct 4, 2010 at 10:58 AM, Rob Podolski <robpodolski@yahoo.co.uk> wrote:
> Hi,
>
> Thanks for putting together Commons FileUpload - can see many advantages in
> using it.  Whilst looking at the APIs I realised that the detection of files
> that are larger than the user-defined size limit set as...
>
> ServletFileUpload upload = new ServletFileUpload(factory);
> upload.setFileSizeMax(10000000L);
>
> will only operate AFTER the file has been received in the servlet request.
>
> Certainly for my purposes, this would be too late. I would not want my user to
> wait for ages while her browser tries to post, say,  a 2 GB file - when the file
> size limit is 10Mb.  Given that javascript cannot obtain access to local files
> (and hence detect the problem early), this is a thorny problem.
>
> Have I miscounstrued things? Any suggestions? Would the streaming API help?

Well, the challenge you're going to face is that the app server is
almost certainly going to buffer up the entire file anyway, regardless
of what you or FileUpload does. It's after the app server has received
the entire file that it will call your web app, and thus the
FileUpload code in it.

--
Martin Cooper



> regards,
>
> Rob
>
>
>
>

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


Mime
View raw message