title: Sending file with POST request with HttpUnit
body: <p>we have a REST service, which we would like to test. I thought about using HttpUnit for this purpose. 
  We sent POST request to a resource URL and after receiving the request we retrieve the file from request. In our server code we have something like this:</p>
  
  <pre><code>MultipartFormData body = request().body().asMultipartFormData();
  FilePart file = body.getFile("upfile");
  File pictureFile = file.getFile();
  </code></pre>
  
  <p>In my test I wrote:</p>
  
  <pre><code>WebConversation wc = new WebConversation();
  WebRequest wr = new PostMethodWebRequest("http://linkToOurResource");
  File f = new File("testFile.jpg");
  wr.selectFile("upfile", f, "multipart/form-data;");
      WebResponse response = wc.getResponse(wr);
  </code></pre>
  
  <p>but I'm getting the following error:</p>
  
  <pre><code>Test functional.AcceptanceTests.testAddingNewClient failed: Parameter 'upfile' is not a file parameter and may not be set to a file value.
  </code></pre>
  
  <p>Any suggestions how to send the file in the POST request to our server?</p>