commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lin <xuhua....@gmail.com>
Subject Re: FileUpload : UnknownSizeException on a file of 3Go
Date Wed, 22 Dec 2004 01:55:25 GMT
I assume you want to upload a large file of 3GB (giga-byte). Since the
maximum int value is about 2G (2147483647), the parsing of
Content-Length header may fail and return -1 if the value of header is
larger than 2G (I haven't checked source code to confirm this.) This
may be a limitation on the servlet API, since in the spec., it
specifies HttpServletRequest.getContentLength returns int, not long.
However, the http protocol allows any number larger than 0 for this
header.  The work around may be parsing this header directly using
Long.parseLong in the FileUploadBase.

Howard


On Tue, 21 Dec 2004 22:22:04 +0100, Nicolas Maujean
<nmaujean@hotmail.com> wrote:
> Hi,
> 
>    I am trying to upload a large file of about 3Go when I am doing it I have
> an UnknownSizeException. I discovered that it came from the FileUploadBase
> class in the method from the method
>     public List /* FileItem */ parseRequest(HttpServletRequest req)
> 
> from this code :
> int requestSize = req.getContentLength();
> 
>         if (requestSize == -1)
>         {
>             throw new UnknownSizeException(
>                 "the request was rejected because it's size is unknown");
>         }
> 
>    Is it possible to upload a file of any size ? if yes, why I can't upload
> this file of 3Go, why I have an UnknownSizeException ? if no, how I can
> bypass it to upload a file of 3Go ?
> 
> thank you for your answer,
> 
> Nicolas Maujean
> 
> ---------------------------------------------------------------------
> 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