ng2-file-upload
ng2-file-upload copied to clipboard
Allowed mime type doesn't support .msg (Outlook) file
Mime type for .msg
allowedMimeType: [ "application/vnd.ms-outlook", ]
I confirm the file is not supported by observing
this.uploader.onWhenAddingFileFailed = () = { console.log("file not supported"); }
Note: all the other type works fine eg: .docx [application/vnd.openxmlformats-officedocument.wordprocessingml.document], .txt ["text/plain"]
In my case, I'm not able to upload any other format except for pdf.
allowedMimeType: [ "application/pdf", ]
It happens same with .xls format as well. In my case, .xls and .msg is not supporting. mime types i have used are - .xls - application/vnd.ms-excel, .msg - application/vnd.ms-outlook
@reddevilzee what version of ng2-fileupload do you use? If I check the currect version of FileType code is see mime type 'application/vnd.ms-excel' is included. So that should be recognized.
Hi @koenvanderlinden,
I am using the current version 1.3.0. That's correct, I used the mime types available in File Type class in my code piece of allowedMimeTypes. Here is my code piece,
// lookup file allowedMimeType = [ 'image/jpeg', 'image/jpg', 'image/tiff', 'image/gif', 'image/bmp', 'image/png', 'image/bpg', 'image/svg', 'application/pdf', //.pdf 'application/msword', //.doc 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', //.docx 'application/vnd.ms-excel', //.xls 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', //.xlsx 'application/vnd.ms-outlook', //.msg 'text/plain', //.txt, 'text/html' //.html ];
// ts file public uploader: FileUploader = new FileUploader({ ... allowedMimeType: this.lookup.allowedMimeType, ... });
everything else works fine except for .xls and .msg.
uploader.onWhenAddingFileFailed is firing for files which have both of these extensions.
For a .xls file I created a test Excel file using MS Excel 2013, saved the file as .xls (Excel 97-2003(*.xls)). Uploaded it. It passed the allowedMimeType filter you proviced in your comments. If I change the 'application/vnd.ms-excel', //.xls to something else. The file is filtered and uploader.onWhenAddingFileFailed is fired. Inspecting the FileLikeObject stated the (mime)type is 'application/vnd.ms-excel'. So I didn't have a problem with the .xls file.
For a .msg file When uploading a .msg file. The (mime)type is ''. So it's not possible to fix this with allowedMimeType. Problably have to add this via the allowedFileType. However .msg is not yet added to the ng2-upload-file code. I'll see if I can create a pull request for that.
@koenvanderlinden Unfortunately, it doesn't allow me yet for .xls. When i upload a .xls file my fileLikeObject states an empty string. Wonder why?! I will try more unit test on this and update in this forum about my results.
I am in progress to create a pull request to allow the file types that I need in my project but not yet supported by this project.
@reddevilzee Do you have MS Office installed on the machine you are testing on? It's the machine that will need to tell the browser/file upload control what mime-type it is.
any updation for supporting .msg file
Would like to use this to upload .msg. Wondering if the issue has been resolved
We are using ng2 file upload and it works perfectly fine with all ms-office related mime types except for .msg. Any work around / solution for .msg mime type? Appreciate your help.
Unable to upload .msg file. I have tried both ways: allowedMimeType and allowedFileType. Please suggest a solution.
@koenvanderlinden The approach using allowedFileType also not working.
Really appreciate any solution.
@karthick-manoharan @ksshafik is there any work around for this issue? are you able to upload file with .msg type?