You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Peter Basil <pe...@gmail.com> on 2012/05/28 20:20:19 UTC

[fileupload] Request empty with IE8

Hi All, 

I am using the Commons FileUpload package to upload a file to the server. 

I have executed my Servlet with Firefox, Chrome and Safari without any problem. 
But when I try with IE8, it fails as the request does not seems to contain the data and upload.parseRequest(request) returns and empty List. 
I wonder whether I am missing anything. 

This is my code: 
____________________________________________
      
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
        response.setContentType("text/html");  
  
        String dFileName = null;  
        String basePath = getServletContext().getRealPath("/");  
        String propConfFile = basePath + "WEB-INF//" + PROP_CONF_FILE;  
        propUtil.load(propConfFile);  
                          
        // create file upload factory and upload servlet  
          FileItemFactory factory = new DiskFileItemFactory();  
          ServletFileUpload upload = new ServletFileUpload(factory);  
            
          List uploadedItems = null;  
          FileItem fileItem = null;  
          FileItem actualFileItem = null;  
            
          try {  
             uploadedItems = upload.parseRequest(request);  
             Iterator i = uploadedItems.iterator();  
      
             while (i.hasNext())  
             { …  
____________________________________________

I am running on apache-tomcat-7.0.27 and the libraries I am using are: commons-fileupload-1.2.2.jar, commons-io-2.1.jar 

Many thanks in advance, 
Peter