I am using org.apache.commons.fileUpload.FileItem
and other related classes for uploading files from local machine to server (Although for the current testing both the machines are same).
I am having .jsp
file as UI and servlet to handle the upload. Now when the request reaches
statement
List items = upload.parseRequest(request);
it returns empty list. I googled this thing at many places. Most of them specifying the symptons that parserequest()
returns empty. But Could not find out the exact solution to avoid this. At one place I could see that Tomcat may have filters that may have parsed The request and thats why at above call to parseRequest returns empty list. But there is no specification how to avoid this.
Is it because of the web server I am using (which is JBOss) ? or has it anything to do with the java version and commons.jar version conflicts ?
I am using
Your help would be very much useful.
I encountered this same problem with a similar setup in Tomcat. The solution was as simple as placing a name attribute on my input file element.
Before I had <input type="file" />
in my HTML form.
Once I added a name tag i.e. <input type="file" name="aFile" />
my DiskFileUpload object stopped returning an empty list when I called parseRequest(request) from the servlet/JSP.