commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Tompkins (JIRA)" <>
Subject [jira] [Closed] (FILEUPLOAD-200) During ServletFileUpload.parseRequest(factory) the servlet appears to read the data from the users file.
Date Mon, 05 Jun 2017 14:40:04 GMT


Rob Tompkins closed FILEUPLOAD-200.

not a problem

> 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 was sent by Atlassian JIRA

View raw message