0

尝试从 Android 应用程序将文件内容发送到服务器,如下所示:

 HttpClient httpclient = new DefaultHttpClient();
 HttpPost httppost = new HttpPost("http://www.yoursite.com/script.php");

final InputStreamEntity reqEntity = new InputStreamEntity(
                    gdFileSystemDelegate.openFileInput(openFileInput(FilePath), -1);
reqEntity.setContentType("application/octet-stream");

httppost.setEntity(reqEntity);
httpClient.execute(httppost);

但是它抛出了一个异常:不能用不可重复的请求实体重试请求

这是什么意思 ?如何解决?

4

1 回答 1

-1

尝试在 DefaultHttpClient 中将协议参数 http.protocol.expect-continue 设置为 true:

@Override
protected HttpParams createHttpParams() {
    HttpParams params = super.createHttpParams();
    HttpProtocolParams.setUseExpectContinue(params, true);
    return params;
}
于 2013-10-14T08:38:33.803 回答