title: Corrupt form data: premature ending
body: <p>I am trying to upload files using the FileReference class. Files >2MB all work correctly but files &lt;2MB cause this error:</p>
  
  <blockquote>
    <p>"java.io.IOException: Corrupt form data: premature ending"</p>
  </blockquote>
  
  <p>On the server I am using the com.oreilly.servlet package to handle the request.</p>
  
  <p>I have used this package many times to successfully handle file uploads from flex, but for some reason, now I am having this problem.</p>
  
  <p>Here is the stack trace for some more info:</p>
  
  <pre><code>java.io.IOException: Corrupt form data: premature ending
      at com.oreilly.servlet.multipart.MultipartParser.&lt;init&gt;(MultipartParser.java:205)
      at com.oreilly.servlet.MultipartRequest.&lt;init&gt;(MultipartRequest.java:222)
      at com.oreilly.servlet.MultipartRequest.&lt;init&gt;(MultipartRequest.java:173)
      at com.mydomain.FileUploadServlet.doPost(FileUploadServlet.java:46)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:414)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
  </code></pre>