I am trying to upload a file from the input field and want to store it in an array.
Upload : <input type="file" name="upload" #uploadFile>
<button (click)="storeFile(uploadFile)">Store file</button>
Now whenever user want to click on the store file, I am calling this function
listOfFile: Array<FileList> = [];
storeFile(inputField: HTMLInputElement) {
this.listOfFile.push(inputField?.files);
console.log(this.listOfFile)
}
The above code is working fine in chrome. However, if you look in the console from Firefox you will see that the array value is overridden. I could not figure out why Firefox is not working.
I have also created a sample app on stackBlitz. Please Have a look at that from your firefox. To see the problem, please upload a file and click the store button and inspect the console. Now try to upload another file and inspect it from Firefox. You will see then, the first value is overwritten.