I have an
<input type="file" accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
like above to accept the .doc and .docx files. When I printed the file object to in Google Chrome console, .docx file type becomes empty. But in Firefox console, file type becomes not empty.
Here is my javascript function of input file change event;
var control = document.getElementById("upload-file");
control.addEventListener("change", function(event) {
var files = control.files,
for (var i = 0; i < files.length; i++) {
console.log("Filename: " + files[i].name);
console.log("Type: " + files[i].type);
console.log("Size: " + files[i].size + " bytes");
}
}, false);
You could try using the file extension ?
Using the same accept attribute:
<input type="file" accept=".doc, .docx, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document">