title: POST-ing text and files with HTTPBuilder and MultipartEntity
body: <p>I am using groovyx.net.http.HTTPBuilder to POST from Grails to a PHP script. I need to attach a couple of text fields and a number of files.</p>
  
  <p>I can attach a few textfields this way with great success:</p>
  
  <pre><code>    MultipartEntity mpc = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE)
      mpc.addPart("json", new StringBody(json.toString()))
  </code></pre>
  
  <p>But, when I attach a file like this, the textfields are no longer present in the request:</p>
  
  <pre><code>        passFiles.each() { key, value -&gt;
              mpc.addPart(key, new InputStreamBody(value.stream, value.type, value.filename))
              System.out &lt;&lt; value
          }
  </code></pre>
  
  <p>I think the file should be okay to add this way. Here is my trace from the above:</p>
  
  <p><code>[filename:icon.png, stream:java.io.ByteArrayInputStream@2747ebcb, type:image/png]</code></p>
  
  <p>How can I cause HTTPBuilder to make this Multipart POST as intended?</p>