Get the imge uploaded

Hello,

I need a user upload a image and convert this image to base64.

I am trying: this:

template:
<input type="file" (change)="fileEvent($event)"/>

ts:

fileEvent(event: any) {
    this.src = null;
    let files = event.target.files;
    let file = files[0];

    var reader = new FileReader();
    reader.addEventListener("load", (event: any) => {
        this.src = event.target.result;
    }, false);

    if (file) {
        reader.readAsDataURL(file);
    }
}

In my browser work fine, but in my phone (android 6.0.1) dont work the var event.target.files is empty.

I read this docs:

But I do not know where to put this code:

declare var cordova: any;
const fs:string = cordova.file.dataDirectory;

Greetings.