File transfer upload fails to run


#1

Hi!
So I am trying to use Transfer but apparently something is wrong and I can not figure out why. I tried following the documentation (https://ionicframework.com/docs/native/transfer/) but I can not make it work…
The problem seems to be that the upload seems to never run. I am using a loading screen but it never gets dismissed. No error is printed either… The path seems to be correct because it loads the image if I use img in my html.
Here is what I have:

    var url = "http://***.**.**.**/UploadController.ashx";
    // File for Upload
    var targetPath = "./bioshock.jpg";

    let headers = new Headers();
    headers.append( 'DeviceAPIKEY', DeviceAPIKEY);
    headers.append( 'DeviceACUID', AccountUID);

    // File name only
    var filename = "bioshock.jpg";

    const fileTransfer: TransferObject = this.transfer.create();

    let options: FileUploadOptions = {
      fileKey: "file",
      fileName: filename,
      chunkedMode: false,
      mimeType: "image/jpeg",
      headers:headers,
      params: {
        filename:filename,
        RUID: RUID,
        MUID: RUID
      }
    };

    this.loading = this.loadingCtrl.create({
      content: 'Uploading...',
    });

    this.loading.present();
    try {
      // Use the FileTransfer to upload the image
      fileTransfer.upload(targetPath, url, options).then(data => {
        this.loading.dismissAll();
        this.presentToast('Image successfully uploaded.');
      }, err => {
        this.loading.dismissAll();
        this.presentToast('Error while uploading file.');
      });
    }
    catch(err) {
      console.log("ERROR",err);
    }

Please help!
THX