On some files, (ios) at the moment is the only platform I'm testing on, if the file is under 30 megs everything seems to work using nativescript-background-http to upload a video file to the server. If the filesize is over 30 megs the upload aborts at exactly 196608 bytes every time.
I know it's not a server issue aborting the upload. As I have set both the POST Size Limits in IIS and the Max File Size Limit in ColdFusion to 500 megs.
mediafilepicker.on("getFiles", function (res) {
let results = res.object.get('results');
if (results) {
for (let i = 0; i < results.length; i++) {
let result = results[i];
let file = result.file;
if (result.file && applicationModule.ios)
{
console.dir(result);
// We can copy it to app directory, if need
//let fileName = "myTmpImage.mov";
var session = bghttp.session("image-upload");
var sFile = result.file.replace("file://", "");
var filename = sFile.substring(sFile.lastIndexOf('/') + 1);
var mimetype = filename.substring(filename.lastIndexOf('.') + 1);
console.log(sFile);
var request = {
url: 'http://www.mobilecoach.me/test_upload.cfm',
method: "POST",
headers: {
"Content-Type": "application/octet-stream",
"File-Name" : filename
},
description: "Uploading"
};
var params = [
{ name: "file", filename: sFile, mimeType: "video/" + mimetype }
];
task = session.multipartUpload(params, request);
task.on("progress", logEvent);
task.on("error", logEvent);
task.on("complete", logEvent);
function logEvent(e) {
console.log("currentBytes: " + e.currentBytes);
console.log("totalBytes: " + e.totalBytes);
console.log(e.eventName);
if(e.eventName == "complete")
{
dialogsModule.alert({
message: "Upload Completed",
okButtonText: "Ok",
cancelable: false
}).then(() => {
})
}
}
}
}
}
});
Like I said on less than 30 meg files works fine. Over 30 megs upload aborts without error just completes/aborts @ exactly 196608 bytes.