Uploaded file has empty type and fails allowedMimeTypes check #1061
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
I'm having a problem on a specific case. I'm running:
"@angular/core": "^6.1.9"Windows 10 Home, 64 bits and MacOS Mojave
I have an uploader provider declared as
where `FILE_TYPES_DOCS is
and then on my component
When I run it on my Macbook, it works just fine for everything, but when I try to upload a
.docfile from the Windows environment nothing happens.Debugging it I found a couple things.
First is that the file uploaded hits the mim type check with empty type, so the check will always return false and nothing will happen.

Then I found this issue and thought that it was my problem (later to find that on my windows env I do have Office). This led me to change my uploader provider to
which didn't work as well.
Need help with that, why is the
typeonly empty on my windows?Thx.
I am facing the same issue with PSD files.
type is recognized by the machine that we are using. I faced the same issue with my macOS since i do not have old versions of MsOffice, yet my users when they ran the app in their windows machine, it recognized old versions and succeeded in uploading. i was succesful in uploading DOCX, XLSX
Hey !
I have the same issue with compressed files: every .zip/.tar/.7z files. As @JGhignatti explained: file type from FileUploader are not populated when uploading compressed file.
I could not find a way to solve the problem using allowedMimeType. So here is my workaround:
First I define my uploader:
Then I am using the
onWhenAddingFileFailedmethod to alert user about the error:`
onAddingFileFailed() {
}
`
This solution is working but it is really not a clean one.
Don't you have another solution ?
@JGhignatti I had the same problem.
Go to Registry Editor (regedit) -> HKEY_CLASSES_ROOT -> .doc. Right click on .doc and select New -> String Value and enter Value name = "Content Type" and Value data = "application/msword".
Repeat the same steps also for HKEY_CLASSES_ROOT -> .docx, but in this case add Value data = "application/vnd.openxmlformats-officedocument.wordprocessingml.document".
thanks for this, this solved my problem.
Hello,
I have the same issue with Google Chrome only.
When I try to upload a specific Word document using Firefox the type is correct but in Google Chrome type is empty.
The solution that you are suggesting is not solid on my application. The reason is that i can fix it on my PC but other users will still getting errors because the type it will be empty an empty string.
Is there any solution to fix that?