title: spray-client upload form with file
body: <p>I have a next form:</p>
  
  <pre><code>   &lt;form action="/upload" method="POST" enctype="multipart/form-data"&gt;
          &lt;input type="text" name="name"&gt;
          &lt;input type="file" name="file"&gt;
          &lt;input type="submit" value="Upload image"&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>I want to send request with <code>name</code> and with <code>file</code></p>
  
  <p>I use <code>spray-client</code> for this, when i send only file this work fine:</p>
  
  <pre><code>val file = "my-image.png"
  val bis = new BufferedInputStream(new FileInputStream(file))
  val bArray = Stream.continually(bis.read).takeWhile(-1 !=).map(_.toByte).toArray
  
  val url = "http://example.com/upload"
  
  val httpData = HttpData(bArray)
  val httpEntity = HttpEntity(ContentTypes.`image/png`, httpData).asInstanceOf[HttpEntity.NonEmpty]
  val formFile = FormFile("my-image", httpEntity)
  val bodyPart = BodyPart(formFile, "my-image")
  val req = Post(url, MultipartFormData(Map("spray-file" -&gt; bodyPart)))
  
  val pipeline = (addHeader("Content-Type", "multipart/form-data")
    ~&gt; sendReceive
  )
  
  pipeline(req)
  </code></pre>
  
  <p>But how to send at the same time file and fields? </p>