commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Polliard (Resolved) (JIRA)" <>
Subject [jira] [Resolved] (FILEUPLOAD-200) During ServletFileUpload.parseRequest(factory) the servlet appears to read the data from the users file.
Date Tue, 27 Sep 2011 22:54:45 GMT


Thomas Polliard resolved FILEUPLOAD-200.

    Resolution: Not A Problem

The issue was that sessions were not being passed between the ajp_proxy(http) and the tomcat
server.  Once I resolved that issue, the system worked as expected.
> During ServletFileUpload.parseRequest(factory) the servlet appears to read the data from
the users file.
> --------------------------------------------------------------------------------------------------------
>                 Key: FILEUPLOAD-200
>                 URL:
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: CentOS 5/Tomcat 7/JDK 1.7 (No Struts, etc...)
>            Reporter: Thomas Polliard
> I have a very basic FileUpload Servlet I am working on.  Using the following code:
>                 FileUploadListener listener = new FileUploadListener();
>                 context.log("DEBUG: Created listener");
>                 FileItemFactory factory = new DiskFileItemFactory();
>                 context.log("DEBUG: Created Disk Factory");
>                 ServletFileUpload uploader = new ServletFileUpload(factory);
>                 context.log("DEBUG: Created ServletFileUpload(factory)");
>                 request.getSession().setAttribute("ProgressListener",listener);
>                 context.log("DEBUG: Listner added to Session");
>                 List<FileItem> items = uploader.parseRequest(request);
>                 context.log("DEBUG: parsedRequest for FileItems");
>                 for (FileItem element : items) {
>                     if (!element.isFormField()) {
>                         context.log("DEBUG:" + element.getName());
>                         File fqfn = new File(f+"/"+element.getName());
>                 <snip>
> I try to upload a file (1G) the servlet appears to "upload" the file during the parseRequest()
call.  This appears to be not valid, as the List<FileItem> is pointless when trying
to use the Listener to tell how much has been uploaded.  The user has already had to wait
for the parseRequest() to complete, and by then the listener says 0 bytes of Unknown Size.
> The file will write in the List<FileItem> loop.  The reason I think this is a bug,
is that I was expecting the parseRequest() to not "upload" the file but rather to return a
list of the formfields as FileItems, and then during the FileItem loop and the subsequent
write() call, the data would actually be written and therefore the Listener would function.
 Perhaps, I do not understand what the API is saying, or am missing some critical point. 
However, all the examples I see online from the Fileupload Site on ASF have the exact same
> Thanks for your time and work.
> Thomas

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message