Is there a way to different the file passed to <input type="file">
elements?
I need to know the type of file the user passed so I can read it afterwards with the HTML5 fileReader API either with readAsDataURL
or readAsText
based on type.
here is a live example of what my code looks like: http://jsfiddle.net/tdq3socz/1/
I understand that the instance of File I'm getting from the input element contains a type
property (like for example type: "application/javascript" or type: "plain/text"
) but that's not practical as there is an endless supply of file-types out there...