File API 101
Selecting a file and getting the info using <input>
by Ehsan Ziya
HTML
<input type="file" id="browser" name="files[]"></input>
<output id='list'></output>
<br>selects only one file javascript returns a list of File objects selected if multiple attribute is there and returns a FileList.
JavaScript
var browser = document.getElementById('browser');
browser.onchange = function(){
file = browser.files[0];
console.log(file.type);
};