我想通过我的 android 应用程序使用以下代码上传视频。
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(uri);
MultipartEntity entity = new MultipartEntity();
ContentBody input = new FileBody(file);
ContentBody name = new StringBody("VID_20130201_162220.3gp");
ContentBody description = new StringBody("Test Description");
entity.addPart("input",input);
entity.addPart("name",name);
entity.addPart("description",description);
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
HttpEntity httpEntity = response.getEntity();
当 httpClient.execute() 方法返回响应时,它显示“HTTP/1.1 415 Unsupported Media Type”
我也尝试过从 HttpPost 中删除 MultipartEntry,但它仍然给出了同样的错误。
有人可以建议我可能是什么问题。