有以下代码:
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);
}
存在以下问题 - 后端代码限制了 POST 请求的 MIME 类型,因此我需要设置我的图像文件(文件文件)的 MIME 类型。我该如何设置?