title: file upload fails after jquery preventDefault
body: <p>I'm trying to do a file upload with JSP / JQuery but I have to make a few Ajax calls before submission. </p>
  
  <p>However, after the Ajax calls are made and the form is submitted the form fields are all empty on the server side?</p>
  
  <p>If I don't call e.preventDefault() then it all works but I need to make Ajax calls pre-submission!</p>
  
  <p>Thanks</p>
  
  <pre><code>CLIENT SIDE:
  
  &lt;form method="post" action="accept.htm" enctype="multipart/form-data"&gt;
    ...
    &lt;input type="file" name="thefile" id="thefile"/&gt;
    &lt;input type="submit" name="uploadfile" id="uploadfile" value="Upload File"/&gt;
    ...
  &lt;/form&gt;
  
  $("form").on("submit", function(e) 
  {
      e.preventDefault(); // stop the form being submitted for now
  
      // make a few ajax calls
      ...
  
      // submit the form in ajax success callback
      $("form").unbind("submit");
      $("form").submit();
  }
  
  SERVER SIDE:
  
  boolean isMultipart = ServletFileUpload.isMultipartContent(request);
  
  ServletFileUpload servletFileUpload = new ServletFileUpload();
  servletFileUpload.setFileSizeMax(Long.valueOf(maxUploadFileSize));
  servletFileUpload.setProgressListener(new UploadProgressListener());
  FileItemIterator fileItemIterator = servletFileUpload.getItemIterator(request);
  
  if(isMultipart)
  {
      while(fileItemIterator.hasNext())  &lt;--- empty?
      {
      ...
      }
  }
  </code></pre>