title: Upload a file from Play webapp to another website using java.io.FileInputStream with Scala
body: <p>In my controller I defined a method upload that is supposed to stream a file that is uploaded from a user to a third party website (like Dropbox or Box.com) via my website. I am limit by the JavaApi (for which I wrote a wrapper). I have to give it a java.io.FileInputStream but I don't know how.</p>
  
  <p>This is the method:</p>
  
  <pre><code>def upload(parentId: String) = Action.async { implicit request =&gt;
      authorized(request, { user =&gt;
        val body = request.body.asMultipartFormData
  
        // somehow i have to transform the body from request to a FileInputStream
  
        val stream: FileInputStream = new FileInputStream(file)
  
        ApiJava.pseudoUpload(user.token, parentId, stream);
        Redirect(routes.Application.showFolder(parentId))
      })
    }
  </code></pre>
  
  <p>The request is send with the standard</p>
  
  <pre><code>@helper.form(action = routes.File.pseudoUpload(currentId), 'enctype -&gt; "multipart/form-data") {
                  &lt;input type="file" name="upoadThis"&gt;
                  &lt;input type="submit"&gt;
                  }
  </code></pre>
  
  <p>Your help is very much appreciated!</p>