title: File Upload With Jersey Not Working
body: <p>I can't get a Jersey file upload to work. Using Jersey 1.9. InputStream is null when the it gets to the service. I've tried it as a normal form submission and as an AJAX submission using the jQuery Form plugin, but get the same result either way. There are no exceptions logged either, making it all the more frustrating.</p>
  
  <p>HTML Form</p>
  
  <pre><code>&lt;form id="docCategoryForm" name="docCategoryForm" action="someAction" method="post" enctype="multipart/form-data"&gt;
  Document
  &lt;input type="file" name="fileupload_name" id="fileupload_name" &gt;
  &lt;button id="submitButton" type="submit" title="Select to search"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>POM</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-json&lt;/artifactId&gt;
      &lt;version&gt;1.9&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;com.sun.jersey.contribs&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-multipart&lt;/artifactId&gt;
      &lt;version&gt;1.9&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>The Dependency Hierarchy in Eclipse shows that mimepull.jar 1.6 is also getting pulled in.</p>
  
  <p>The REST service</p>
  
  <pre><code>@ResourceFilters({RequestLoggingResourceFilter.class})
  @POST
  @Path(PATH_UPLOAD)
  @Consumes(MediaType.MULTIPART_FORM_DATA)
  @Produces(MediaType.APPLICATION_JSON)
  public MyResponseObject uploadDocument(@FormDataParam("fileupload_name") InputStream file) {
    // Some code
  }
  </code></pre>
  
  <p>If I add @FormDataParam("fileupload_name") FormDataContentDisposition fileDetail, I get that just fine, but the InputStream is still null.</p>
  
  <p>Here is the request after trying to upload a simple text file. Looks ok to me.</p>
  
  <pre><code>* Server in-bound request
  &gt; POST http://localhost:7001/webmodule/app/contmang/page/docCategory
  /uploadDocument
  &gt; Host: localhost:7001
  &gt; Connection: keep-alive
  &gt; Content-Length: 209
  &gt; Accept: */*
  &gt; Origin: http://localhost:7001
  &gt; X-Requested-With: XMLHttpRequest
  &gt; User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36(KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
  &gt; Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryl0Uv1KBFoVtOpHto
  &gt; Referer: http://localhost:7001/webmodule/app/contmang/page/docCategory
  &gt; Accept-Encoding: gzip,deflate,sdch
  &gt; Accept-Language: en-US,en;q=0.8
  &gt; Cookie: JSESSIONID_HEARS=yWHQSpFbZnh1Jfp6hmn4xmfyxxTpybnvTTxsTykyqXzQyt207wym!-153888503
  &gt;  Entity:------WebKitFormBoundaryl0Uv1KBFoVtOpHto
  Content-Disposition: form-data; name="fileupload_name"; filename="test.txt"
  Content-Type: text/plain
  
  Hello, World!!
  
  ------WebKitFormBoundaryl0Uv1KBFoVtOpHto--
  </code></pre>