commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arijit Mukherjee" <Arijit.Mukher...@newcastle.ac.uk>
Subject [fileupload] Help with Commons FileUpload
Date Mon, 09 Oct 2006 13:50:16 GMT
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


Mime
View raw message