I am trying to read files from a client through FileReader. I want to create a copy in the browser but I can't figure out how to do it properly.
In this JSFiddle i have replicated my problem with the exception that I use a custom class File
instead of Object, but it's the same result.
If I only select one file, everything is perfectly fine,but as soon as I select multiple files the errors appear. Firstly, all properties of the new Object i create on line 9
except the data
is always the last file selected. The function storeResult
get the result from fileReader OK, but not from my new Object file?
When I click 'Check Array' all objects in the arrays property data
is now the last file selected. My guess is that it has something to do with scope of some of my variables but I can't figure out where and why.