I'm using the file select input to upload multiple files. After a user selects their files, I'm sorting through the FileList
in a loop to check if there are any HEIC/HEIF files, so I can display an error message.
const fileSelect = document.createElement("input");
fileSelect.setAttribute("type", "file");
fileSelect.setAttribute("multiple", "multiple");
fileSelect.click();
if(!this.vm.acceptedTypes.includes(file.type)) {
console.log(file);
this._$inj.globalFac.showAlert(file.name, `Error: File type ${file.type} is not supported.`);
continue;
}
However, when a user uploads a HEIC/HEIF file, the type
property is blank. Why?
.type
: "On getting, user agents must return the type of a Blob as an ASCII-encoded string in lower case, such that when it is converted to a byte sequence, it is a parsable MIME type, or the empty string – 0 bytes – if the type cannot be determined." – Highjack