0

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");
       });
James Z
  • 12,209
  • 10
  • 24
  • 44
  • Please add the error message, looks like you've forgotten to add it. Also, adding the specific code snippet will help resolve your issue. – Amulya K Murthy Jan 31 '20 at 05:50
  • I have edited my question hope it will help you to solve it – Rachana Sharma Jan 31 '20 at 06:01
  • That can be server issue. Please make sure these are ok https://stackoverflow.com/questions/578190/can-file-uploads-time-out-in-php – Bik Jan 31 '20 at 06:09
  • But I am able to upload same file from Android device to the same server but its giving timeout error when tried to upload it from IOS device – Rachana Sharma Jan 31 '20 at 06:13

0 Answers0