Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

I've got an error cannot read property 'split' of undefined in ionic file plugin

$
0
0

@klejz0r wrote:

Guys i’ve got an issue while doing this function.

const options: CameraOptions = {
quality: 100,
allowEdit: true,
sourceType: source,
saveToPhotoAlbum: true,
correctOrientation: true,
encodingType: this.camera.EncodingType.JPEG,
destinationType: this.camera.DestinationType.FILE_URI
}

this.camera.getPicture(options).then((imageData) => {
    //needs to import file plugin
    //split the file and the path from FILE_URI result
    let filename = imageData.substring(imageData.lastIndexOf('/')+1);
    let path =  imageData.substring(0,imageData.lastIndexOf('/')+1);
         //then use the method reasDataURL  btw. var_picture is ur image variable
         this.file.readAsDataURL(path, filename).then(res=> var_picture = res  );
})



ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'split' of undefined

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles