I came across the same issue/problem that the browser doesn't return correct mime-type for outlook-msg-files. Instead of application/vnd.ms-outlook
the type-property of File
shows an empty string.
I used the following workaround (by checking the file-extension) to overcome this problem:
In my file-upload-logic, I test the dragged or selected file(s) if they are from any or more accepted mime-types. If there is a file without given mime-type, then I check the file-extension.
Further validation logic, e.g. if the given file is really of outlook-message-type, can be done on the server-side with your prefered programming language.
let enableOutlookMimetypeDetection: boolean = true;
let acceptRegexString: string = "(image/png)|(application/vnd.ms-outlook)"; // maybe you have to escape the slashes in the regex
let allowOutlookMsgFiles: boolean = enableOutlookMimetypeDetection && acceptRegexString.indexOf("application/vnd.ms-outlook") >= 0;
let acceptRegex: RegExp = new RegExp(acceptRegexString);
for (let i: number = 0; i < files.length; i++) {
if (allowOutlookMsgFiles) {
if (files[i].name !== null && files[i].name !== undefined && files[i].name.endsWith(".msg")) {
console.log("outlook msg-file found");
continue;
}
}
if (!acceptRegex.test(files[i].type)) {
return false;
}
}
return true;