post 中止文件上传
Abort file upload by post
我用org.apache.http.client.HttpClient
将大文件从 Android 上传到服务器。
(...)
entity.addPart(...)
entity.addPart("mediafile", new FileBody(file));
httpost.setEntity(entity);
HttpResponse response = httpClient.execute(httpost);
(...)
文件很大,如果用户请求,我需要一个取消上传的方法,但是 HttpClient 没有中止网络操作的功能。
如何终止此网络操作?
but HttpClient don´t have function to abort network operation.
您可以使用httpost.abort();
希望对您有所帮助!
我用org.apache.http.client.HttpClient
将大文件从 Android 上传到服务器。
(...)
entity.addPart(...)
entity.addPart("mediafile", new FileBody(file));
httpost.setEntity(entity);
HttpResponse response = httpClient.execute(httpost);
(...)
文件很大,如果用户请求,我需要一个取消上传的方法,但是 HttpClient 没有中止网络操作的功能。
如何终止此网络操作?
but HttpClient don´t have function to abort network operation.
您可以使用httpost.abort();
希望对您有所帮助!