cordova FileTransfert在两个错误上工作一次3

cordova FileTransfert在两个错误上工作一次3,cordova,cordova-plugins,Cordova,Cordova Plugins,我对cordova的fileTransfert插件有一个奇怪的问题(目标设备是Android 4.3,它在Android 6.0上工作)。 我只是来上传一个文件。 第一次和第三次发送工作正常,但第二次发送返回错误代码3,日志中包含此错误消息: E/FileTransfer(15179): {"target":"https:\/\/XXXX\/uploadTeamPicture","http_status":0,"code":3,"source":"file:\/\/\/storage\/emul

我对cordova的fileTransfert插件有一个奇怪的问题(目标设备是Android 4.3,它在Android 6.0上工作)。 我只是来上传一个文件。 第一次和第三次发送工作正常,但第二次发送返回错误代码3,日志中包含此错误消息:

E/FileTransfer(15179): {"target":"https:\/\/XXXX\/uploadTeamPicture","http_status":0,"code":3,"source":"file:\/\/\/storage\/emulated\/0\/Pictures\/2017_4_14\/XXXXX_14-15-00.jpeg","exception":"Write error: ssl=0x6e653128: I\/O error during system call, Broken pipe"}
这就是函数

// Manage File sending
function uploadFile(webAddr,fileURL,params)
{
    // when it's finished
    var win = function (r) {

       alert("Picture has been sent correctly !","Information"); 
       $("#takePicture").hide();
       resetAppli();
       fileTrans.abord();
    };
    // if upload failed
    var fail = function (error) {
        var msg="Please take another picture \n"; 
        msg+="An error has occurred: Code = " + error.code;
        msg+="\n src:"+error.source;
        msg+="\n trgt:"+error.target;
        alert(msg);
        $("#takePicture").hide();
        resetAppli();
    };


    var uri = encodeURI(webAddr);

    var options = new FileUploadOptions();
    options.fileKey="fileToUpload";
    options.fileName=fileURL.substr(fileURL.lastIndexOf('/')+1);
    options.mimeType="text/plain";

    var headers={'headerParam':'headerValue'};

    options.headers = headers;
    options.params = params;

    //var ft = new FileTransfer();
    var ft=fileTrans;
    ft.onprogress = function(progressEvent) {
        if (progressEvent.lengthComputable) {
            //loadingStatus.setPercentage(progressEvent.loaded / progressEvent.total);
            uploadProgress(progressEvent);
            var infoProg=(progressEvent.loaded / progressEvent.total);
            console.log("Progress :" + infoProg);
        } else {
            //loadingStatus.increment();
        }
    };
    // init progress bar before sending
    initProgressBar();
    // send file
    ft.upload(fileURL, uri, win, fail, options);

}
如果有人有主意。。。 非常感谢您的帮助

在此处找到解决方案:

只需在参数表的末尾添加true选项。

在此处找到解决方案:


只需在参数表的末尾添加true选项。

尝试更改函数的这一行

ft.upload(fileURL, uri, win, fail, options);
为此:

ft.upload(fileURL, uri, win, fail, options, true);
var headers={Connection:'close'};
这一行:

var headers={'headerParam':'headerValue'};
为此:

ft.upload(fileURL, uri, win, fail, options, true);
var headers={Connection:'close'};

尝试更改函数的这一行

ft.upload(fileURL, uri, win, fail, options);
为此:

ft.upload(fileURL, uri, win, fail, options, true);
var headers={Connection:'close'};
这一行:

var headers={'headerParam':'headerValue'};
为此:

ft.upload(fileURL, uri, win, fail, options, true);
var headers={Connection:'close'};