I have the following code snippet for uploading firebse storage I'm using typescript.
uploadPhoto(photo) {
//Get File
this.file = photo.files[0]; // Erro nessa linha
this.metadata = {
'contentType': this.file.type
};
//Create a storage ref
this.storageRef = firebase.storage().ref().child('images/');
// Upload file
this.storageRef.put(this.file, this.metadata);
}
It gives the following error:
TypeError: Cannot read property 'files' of undefined