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

Reply via email to