Php Android http POST获取上载\u错误\u部分

Php Android http POST获取上载\u错误\u部分,php,android,http,post,upload,Php,Android,Http,Post,Upload,我的android应用程序正在使用HTTP Post发送一个大约50mb的大文件 这是我的密码: protected String doInBackground(String... params) { HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpPost httpPost = new

我的android应用程序正在使用HTTP Post发送一个大约50mb的大文件 这是我的密码:

protected String doInBackground(String... params) {

        HttpClient httpClient = new DefaultHttpClient();
        HttpContext localContext = new BasicHttpContext();
        HttpPost httpPost = new HttpPost(params[0]);
        String responseLine = null;
        try {
            MultipartEntityBuilder entity = MultipartEntityBuilder.create();
            entity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
            entity.addPart("file", new FileBody(mFile));
            httpPost.setEntity(entity.build());
            HttpResponse response = httpClient.execute(httpPost, localContext);

            StatusLine statusLine = response.getStatusLine();

            // if the response from my server is length = 2 that means everything
            // went ok
            if (statusLine.getStatusCode() == HttpStatus.SC_OK &&   response.getEntity().getContentLength() == 2) {

            }

        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
          //blabla..
        }

        return "ok";
    }
在我的服务器上上传php代码

 // log in files
 file_put_contents( 'screen/debug' . time() . '.log', var_export( $_FILES, true));
     $objFile = $_FILES["file"];
        $target_path = $_SERVER['DOCUMENT_ROOT'] . "/test/" . basename($_FILES['file']['tmp_name']);

        if( move_uploaded_file( $objFile["tmp_name"], $target_path) ) {
            print "ok";
        } else {
            print "There was an error uploading the file, please try again!";
        }
因此,这段代码在大多数情况下工作得相当好。但有时太过频繁地忽略上传失败。在我的服务器错误日志中,我得到了PHP错误上传\u ERR\u PARTIAL

我的服务器是一个测试服务器,具有 上载\u最大\u文件大小=400M 立柱最大尺寸=512M 最大执行时间=3600 最大输入时间=3600;每个脚本可能用于分析请求数据的最长时间 内存限制=1024M;脚本可能消耗的最大内存量


有人知道我为什么会出现这个错误吗?

你能发布LOGCAT错误吗?没有LOGCAT错误,因为我个人无法重现错误…我只是看到文件没有上传,我有上传错误部分错误。。。