title: equivalent cURL --data-binary @filename -H "Content-Type:text/csv" in java
body: <p>I am using Apache http client, using cURL, the command would be:</p>
  
  <pre><code>curl -i -X POST --data-binary @data.csv -H "Content-Type:text/csv" "http://localhost:8080/"
  </code></pre>
  
  <p>What is the equivalent in Java(Apache Http Client) ? I tried the following:</p>
  
  <pre><code>HttpPost postRequest = new HttpPost("...");
  MultipartEntityBuilder builder = MultipartEntityBuilder.create();
  File file = new File("data.csv");
  builder.addBinaryBody("upfile", file, ContentType.create("text/csv"), "data.csv");
  HttpEntity entity = builder.build();
  postRequest.setEntity(entity);
  client.execute(postRequest);
  </code></pre>