You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Nicolas Maujean <nm...@hotmail.com> on 2004/12/21 22:22:04 UTC

FileUpload : UnknownSizeException on a file of 3Go

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


Re: FileUpload : UnknownSizeException on a file of 3Go

Posted by Joe Smith <ap...@yahoo.com>.
I am having same problem to upload a huge file, but when I tried in local using WSAD, it is able to upload and no error. But after I deploy to the server and run from there, then I have error "The page cannot be displayed." I don't get "UnknownSizeException" though. So this is not the apache file upload problem, but servlet limitation?
 
 
please advise. thanks!!

Howard Lin <xu...@gmail.com> wrote:
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
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


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: FileUpload : UnknownSizeException on a file of 3Go

Posted by Howard Lin <xu...@gmail.com>.
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
<nm...@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