NativeScript / nativescript-background-http

Background Upload plugin for the NativeScript framework
Apache License 2.0
102 stars 50 forks source link

Andriod: Get error response code 1 when trying to record and upload bigger then 30MB #254

Open Ghits-nl opened 5 years ago

Ghits-nl commented 5 years ago

I am getting de responseCode 1 on error. code: global.SendDoc = function(ScanBuffer,ZAsessieid) { var SendDoc = ScanBuffer[0]; console.log( "er zijn " + ScanBuffer.length + " docs to send");

var docsdone = scancounter - ScanBuffer.length;
MaxProgress += ProgStep; //doc ophoging 1
getScanFromID(SendDoc)
.then( row => { 
   var BestandPad =row[0][4];
   var fileName = FileRename( row[0][3], ZAsessieid) ;  // 
   log("sending " + fileName ,3);

    var session = bghttp.session("image-upload");
    var request = 
    {
        url: klanturl+ "/FileUploader.asmx/UploadScan",
        method: "POST",
        headers: 
        {
            "Content-Type": "application/octet-stream",
            "File-Name": fileName,
            "AUTHCOOKIE": token,
        },
        description: "{ 'uploading': '" + fileName + "' }"
    };
    var task = session.uploadFile( BestandPad, request); 
    task.on("error", uploadfail);
    task.on("complete", uploadsuccess);   

})
.catch( error =>
{       KillSending( "error  : ( " + error + " ) ");   
});  

} //////////////////

function uploadfail (error) { //Getting 1 here console.log("Fout bij upload. response code --------------------------"+ error.responseCode); //Getting NULL here console.log("Fout bij upload. response code --------------------------"+ error.response); log("uploadfail 1 : " + "Error Upload ", 2); }