I am currently working with Angular 6 and Firebase. I am looking to update an image on the server.
Here is a snippet of my HTML:
<div class="form-check">
<input type="file" (change)="onFileSelected($event)">
</div>
This is the variable I am using: selectedFile = null;
Below is the method in my component:
onFileSelected(event) {
this.selectedFile = event.target.file[0];
}
I encountered this error message:
ERROR TypeError: Cannot read property '0' of undefined
Does anyone know why this error is occurring?