我想在服务器上传文件,我正在使用HttpPost发送MultipartEntity。 但是我收到了这个错误
无法打开' /system/framework/qcom.fmradio.jar':没有这样的文件或目录 W / art:无法打开zip存档' /system/framework/qcom.fmradio.jar':I / O错误
即使我同意了Internet和write_external_storage
这是我的代码
private void uploadVideo(String videoPath) {
try
{
int SDK_INT = android.os.Build.VERSION.SDK_INT;
if (SDK_INT > 8)
{
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
//your codes here
}
Log.e("upload file asynctask","-->"+videoPath);
HttpClient client = new DefaultHttpClient();
File file = new File(videoPath);
HttpPost post = new HttpPost(UPLOAD_URL);
MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
entityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
entityBuilder.addBinaryBody("uploadfile", file);
// add more key/value pairs here as needed
HttpEntity entity = entityBuilder.build();
post.setEntity(entity);
HttpResponse response = client.execute(post);
HttpEntity httpEntity = response.getEntity();
Log.e("result--->", EntityUtils.toString(httpEntity));
}
catch(Exception e)
{
e.printStackTrace();
}
}
请帮助我..提前致谢