The solution below works only if you are prepared to store as much
data as the client wants to send. However, the size check in
FileUpload is designed to prevent exactly that.

If the client wants to upload a 2GB file, and you use the code below,
then you'd better have 2GB available to store that request, because
parseRequest() won't return until it's done parsing all that data. The
point of the size check in FileUpload is so that FileUpload knows when
to ignore the incoming stream. (Unfortunately, the container will
continue to receive it, but that's a separate issue.)

To answer your original question in this thread, no, it's not
currently possible to access items prior to one that blows the limit.
However, I can see how that might be useful in some constrained
situations, so feel free to file an enhancement request in the bug
database for that.

--
Martin Cooper


On 4/21/05, Tom Eugelink <[EMAIL PROTECTED]> wrote:
> Thanks Dakota,
> 
> The solution was very simple:
> 
> ...
> 
>         // we always want to be able to get the ID
>         // so we do the filesize check ourselves
>          int lRequestSize = request.getContentLength();
>         lFileUpload.setSizeMax(lRequestSize);
> 
> ...
> 
>         lFileItems = lFileUpload.parseRequest(request);
> 
> ...
>         //
>         // manually check the size
>          if (iMaxSize >= 0 && lRequestSize > iMaxSize)
>          {
>                 response.sendRedirect(iOnError + "?id=" + lId);
>                 return;
>          }
> 
> Great help.
> 
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to