Ionic 2 Photo upload error with cordova transfer plugin


TypeError: Cannot read property ‘split’ of null(…)

i am getting this error while uploading the photo on server using cordova file transfer plugin.

Here is code for image picker

  ImagePick() {
    let options = {
      destinationType   : Camera.DestinationType.FILE_URI,
      sourceType        : Camera.PictureSourceType.PHOTOLIBRARY,
    Camera.getPicture(options).then((imageData) => {
      // imageData is either a base64 encoded string or a file URI
      // If it's base64:
      this.Image = imageData;
      // this.getFileEntry(imageData);
    }, (err) => {
      // Handle error

Here is code for File transfer plugin

 let options = {
      fileKey: "avatar",
      fileName: "image.jpg",
      mimeType: "image/jpeg",
      params: {
        food: this.navParams.get("food"),
        location_id: this.navParams.get("location"),
        address: this.navParams.get("address"),
        instructions: this.navParams.get("instructions"),
          code: "b08d131e06",
        outlets_attributes: 'outlet'
      headers: {headers: this.user_service.Get_Header()}

   let fileTransfer = new Transfer();
      if(this.Image!=null && this.Image!=""){
            fileTransfer.upload(this.Image, URL, options).
            then((data) => {
            }, (err) => {

Need help regarding that issue. Thanks!


I cant see where you are using split in your code. Anyways this article explain more on how to use the plugin