title: How to add MIME type to POST request Java?
body: <p>There is the following code:</p>
  
  <pre><code>public static void uploadUserpick(File file) throws URISyntaxException, ClientProtocolException, IOException {  
      HttpClient httpclient = new DefaultHttpClient();
      HttpPost httppost = new HttpPost(USERPICK_URL);
      MultipartEntity entity = new MultipartEntity();
      entity.addPart("upload", new FileBody(file));
      httppost.setEntity(entity);
      HttpResponse response = httpclient.execute(httppost); 
  }
  </code></pre>
  
  <p>There is the following problem - back-end code restricts a MIME type of POST request, therefore I need to set MIME type of my image file (File file). How can I set it?  </p>