I understand IE9 and below don’t support file uploads for inputs with multiple files.
But I’m unable to even grab the file in a single file upload!
HTML:
<input type='file' id='imgfile' />
Javascript:
var input = document.getElementById("imgfile");
input.addEventListener("change", function (evt) {
file = this.files[0]; /** Is it possible to even just do this much in IE? **/
if (!!file.type.match(/image.*/)) {
if ( window.FileReader ) {
reader = new FileReader();
reader.onloadend = function (e) {
showUploadedItem(e.target.result, file.fileName);
};
reader.readAsDataURL(file);
}
if (formdata) {
formdata.append("images[]", file);
}
}
/* some stuf */
}
I know the FileReader API won’t work in IE, then what will? There must be some solution. I’ve spent a while on this but it’s eluding me!
Edit
I should have mentioned, I’m using ajax. So this javascript above is trigger after the uploaded file is uploaded using PHP. Does this mean that we can’t even use ajax in IE?
input.filesis an HTML5 property and it most likely not supported in whatever browser you’re testing this with.Have you tried
input.value?