Cordova file transfer plugin not working with ionic 2 RC0


#1

Since updating my ionic 2 app to release candidate RC0 the Cordova file transfer plugin is no longer working properly. The server doesn’t get any of the parameters (params).

My code looks like this:

        var now = Date.now();
        const ft = new Transfer();
        var options:any;
        options = {
          fileKey: "photo",
          fileName: this.userID + '_' + now + '_' + fileURL.substr(fileURL.lastIndexOf('/') + 1),
          mimeType: "image/jpeg",
          params: {
            user_id: 1, 
            title: this.title,
            item_type: 'P',
            latitude: this.latitude,
            longitude: this.longitude,
            timestamp: this.dateTime},
          headers: {}
        };

        options.headers = headers;
    
        ft.upload(this.data, encodeURI(API_ENDPOINT + 'photoupload/'), options, true)
          .then((result: any) => {
            this.submiting = false; // Clear submitted flag              
            let alert = this.alertCtrl.create({
              title: 'Done!',
              subTitle: 'Your photo was been uploaded and is now waiting to be approved (this can take up to 3 days). Thank you for contributing to the World Image Archive.',
              buttons: [
                {
                  text: 'Ok',
                  handler: data => {
                  }
                }
              ],
            });
            alert.present(alert);
          })
          .catch((error: any) => {
            console.log('****** PhotoPage: image upload failed with error:'+JSON.stringify(error));
            this.showAlert('Problem Uploading Image', 'Image upload failed');
          });
      });

ft.upload runs, and appears to upload the file, but the server complains that the expected parameters do not exist. The server can also not find the photo data.

This worked fine before upgrading to ionic 2 RC0 from ionic 2 Beta10