There is the following 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);
}
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?