我正在使用httppost上载一个多部分数据块,并将其输入httpclient对象执行方法,如下所示:
HttpPost loginPost = new HttpPost(LOGIN_URL);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("_email", mEmailAddress));
params.add(new BasicNameValuePair("lpassword", mPassword));
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params, "UTF-8");
loginPost.setEntity(entity);
HttpResponse resp = mHttpClient.execute(loginPost);
HttpPost post = new HttpPost(UPLOAD_URL);
FileBody bin = new FileBody(file);
MultipartEntity me = new MultipartEntity();
me.addPart("stuff", new StringBody(stuff));
me.addPart("file", bin);
post.setEntity(new RequestEntityEx(me, handler));
mHttpClient.execute(post);
现在,登录和发布工作-很好,但上传速度非常慢。我已经测试了我的互联网连接,它比应该的慢得多(大约是1兆字节/秒,上传3兆字节的文件需要5分钟(而不是30秒)。
有人有什么想法吗?