I'm using File transfer plugin to upload PDF files to a remote server in Ionic 4.I can upload files up to size: 1Mb using my code in IOS, but for files greater than this size its returning the following error but for Android its just working fine.
Getting Code 3 error with File Transfer Error: The request timed out.
{ body = ""; code = 3; "http_status" = 0; source = "/private/var/mobile/Containers/Data/Application/D09FA8D8-E447-4BF9-911B-74F07CD6B3F5/tmp/com.vghybrid.snfreferral-Inbox/Scan_Test_-_39_pages_test-1-1.pdf"; target = "https://snfscan.com/customapi/api.php"; }
Code I used is specified below:
var options:FileUploadOptions = {
fileKey: "uploadedFile",
fileName: filename,
chunkedMode: false,
// mimeType: "multipart/form-data",
mimeType: "application/pdf",
headers :{
// Connection: "close"
},
params : {
'tId': tokenId,
'action': "uploadPDF",
'userId': 104
}
};
const fileTransfer: FileTransferObject = this.transfer.create();
fileTransfer.upload(originalFileURL,url,options).then(res=>{
console.log("Succesfully uploaded");
});