commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <li...@serff.net>
Subject Re: [fileupload] Help with Commons FileUpload
Date Mon, 09 Oct 2006 15:28:01 GMT
What are you running on?  Apache/Jakarta/Jboss?  What version?

Andrew 
Arijit Mukherjee wrote:
> Thanx Andrew - but I've already tried a nightly build - it didn't help.
> Seems like the request doesn't even reach the server's file handling
> method:-((
>
> Arijit 
>
>   
>> -----Original Message-----
>> From: Andrew [mailto:lists@serff.net] 
>> Sent: 09 October 2006 16:12
>> To: Jakarta Commons Users List
>> Subject: Re: [fileupload] Help with Commons FileUpload
>>
>> Yes, contentLength is an INT.  That is what was killing me 
>> when using FileUpload 1.1.1.  It would get a negative number 
>> as the content length and throw that UnknownSizeException.  
>> The nightly builds seem to have fixed that for me though as 
>> they actually pay attention to the maxSize parameter now (i.e. 
>> if it is -1, then ignore contentSize). 
>>
>> As for the 32 bit windows/linux, i haven't tried that.  I'm running on
>> 64 bit linux/solaris.
>>
>> Andrew
>> Arijit Mukherjee wrote:
>>     
>>> By any chance, can it be limited by the contentLength of the http 
>>> request - because that's an INT?
>>>
>>> Arijit
>>>
>>>   
>>>       
>>>> -----Original Message-----
>>>> From: Arijit Mukherjee [mailto:Arijit.Mukherjee@newcastle.ac.uk]
>>>> Sent: 09 October 2006 14:50
>>>> To: Jakarta Commons Users List
>>>> Subject: [fileupload] Help with Commons FileUpload
>>>>
>>>> Hi All
>>>>
>>>> It's about the max allowable upload again.
>>>>
>>>> Earlier, I was trying to upload a single file (from a servlet)
>>>>     
>>>>         
>>>>> 2GB, which didn't work. The methods I've been using are as
>>>>>       
>>>>>           
>>>> in the mail below.
>>>> It seems that the "handleFile" method isn't being invoked at all.
>>>>
>>>> I tried to break the file into smaller chunks < 2GB, but 
>>>>         
>> even in that 
>>     
>>>> case, the upload doesn't work, and now I'm getting an error 
>>>>         
> >from the 
>   
>>>> browser -
>>>>
>>>> "The connection was reset         
>>>> The connection to the server was reset while the page was loading.
>>>>    *   The site could be temporarily unavailable or too busy. 
>>>> Try again
>>>> in a few
>>>>          moments.
>>>>    *   If you are unable to load any pages, check your computer's
>>>> network
>>>>          connection.
>>>>    *   If your computer or network is protected by a firewall 
>>>> or proxy,
>>>> make sure
>>>>          that Firefox is permitted to access the Web."
>>>>
>>>> There is a similar error on IE too.
>>>>
>>>> My question is - if there is a problem with the file size, then the 
>>>> servlet should throw an exception while invoking the commons upload 
>>>> APIs. But, it's not going there at all - as it seems. I had 
>>>>         
>> a feeling 
>>     
>>>> that there might be limits in size in the HTTP request itself - but 
>>>> even that's not the case because I've been able to upload bigger 
>>>> files with the same code on a Mac Powerbook (using commons-upload 
>>>> 1.0). It's failing when I'm trying to do the same thing on a WinXP 
>>>> machine or a Linux machine. Earlier I posted a message suspecting 
>>>> that it probably has something to do with addressing system of the 
>>>> machines - like 64 bit or 32 bits - but I thought that would be the 
>>>> case for a single file size.
>>>>
>>>> Has anyone been able to upload files > 2GB on a windows or linux (32
>>>> bit) system? Can you please give me some pointers?
>>>>
>>>> Thanx in advance
>>>> Arijit
>>>>
>>>>
>>>>
>>>>     
>>>>         
>>>>> -----Original Message-----
>>>>> From: Arijit Mukherjee [mailto:Arijit.Mukherjee@newcastle.ac.uk]
>>>>> Sent: 02 October 2006 17:09
>>>>> To: commons-user@jakarta.apache.org
>>>>> Subject: Commons - Help with Commons FileUpload
>>>>>
>>>>> Hi All
>>>>>
>>>>> I have been using the Apache Commons FileUpload package for some 
>>>>> time (mostly simple use cases) but stuck into something recently.
>>>>>       
>>>>>           
>>>> I'm trying
>>>>     
>>>>         
>>>>> to upload files (greater than 2GB) onto a server using the commons 
>>>>> upload package within a servlet (inside tomcat). Anything
>>>>>       
>>>>>           
>>>> less than 2GB
>>>>     
>>>>         
>>>>> works alright (although slowly), but anything more than 
>>>>>           
>> that simply 
>>     
>>>>> doesn't do anything. In the "doPost" method of the servlet, I
>>>>>       
>>>>>           
>>>> have two
>>>>     
>>>>         
>>>>> options based on an init parameter - either handling the 
>>>>>           
>> option, or 
>>     
>>>>> handling the file - so the commons API's are used in the 
>>>>> handleFile() method -
>>>>>
>>>>> public void doPost(HttpServletRequest request, HttpServletResponse
>>>>> response)
>>>>>            throws IOException, ServletException {
>>>>>        try {
>>>>>            if (!init) {
>>>>>                mLog.debug("Handling file input...");
>>>>>                handleFile(request, response);
>>>>>            } else {
>>>>>                mLog.debug("Handling option input...");
>>>>>                handleRadioOption(request, response);
>>>>>            }
>>>>>        } catch (Exception ex) {
>>>>>            ex.printStackTrace();
>>>>>        }
>>>>> }
>>>>>
>>>>> private void handleFile(HttpServletRequest request,
>>>>>       
>>>>>           
>>>> HttpServletResponse
>>>>     
>>>>         
>>>>> response)
>>>>>                            throws IOException, ServletException {
>>>>>
>>>>> 	PrintWriter out = response.getWriter();
>>>>> 	...
>>>>> 	boolean isMultipart =
>>>>> ServletFileUpload.isMultipartContent(request);
>>>>> 	// Create a new file upload handler
>>>>>            FileItemFactory factory = new DiskFileItemFactory();
>>>>>            ServletFileUpload upload = new 
>>>>>           
>> ServletFileUpload(factory);
>>     
>>>>>            // Set overall request size constraint
>>>>>            upload.setSizeMax(-1);
>>>>>            upload.setFileSizeMax(-1);
>>>>>            // Parse the request
>>>>>            List items = upload.parseRequest(request);
>>>>> 	...
>>>>> }
>>>>>
>>>>> It seems that when the files are selected and the "upload" 
>>>>> button is clicked on the browser (a submit action), the
>>>>>       
>>>>>           
>>>> control doesn't
>>>>     
>>>>         
>>>>> go into this method at all - only when one of the files are
>>>>>       
>>>>>           
>>>> larger than
>>>>     
>>>>         
>>>>> 2GB - otherwise, it executes fine.
>>>>> I've tried several combinations for setting the max file
>>>>>       
>>>>>           
>>>> size, but none
>>>>     
>>>>         
>>>>> seem to work. Can it be related to the servlet APIs 
>>>>>           
>> somehow? Is the 
>>     
>>>>> httpRequest size too large in this case?
>>>>>
>>>>> Thanx in advance for any help.
>>>>>
>>>>> Regards
>>>>> Arijit
>>>>>
>>>>>
>>>>> "And when the night is cloudy,
>>>>> There is still a light that shines on me, Shine on until
>>>>>       
>>>>>           
>>>> tomorrow, let
>>>>     
>>>>         
>>>>> it be. "
>>>>>
>>>>> John Lennon/Paul McCartney
>>>>>
>>>>>
>>>>>       
>>>>>           
>> ---------------------------------------------------------------------
>>     
>>>> 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
>>>
>>>   
>>>       
>>
>> ---------------------------------------------------------------------
>> 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
>
>   



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