I have studied many articles and posts to learn about File API and still don't understand why almost all of them use event.target instead of reader. Here are three examples:
- File API
- Using files from web applications | MDN
The last reference even recommends using event.target:
The FileReader instance is available inside of the event handler via event.target and it’s recommended to use that instead of referencing the reader variable directly.
But why is it recommended and widely used? What's wrong with using reader or simpler this instead: DEMO.
I know this and event.target can be different, but in this case they both refer to the FileReader object.
While you can use reader.onload, then why not reader.result?
This topic is now closed. New replies are no longer allowed.