ng2-file-upload icon indicating copy to clipboard operation
ng2-file-upload copied to clipboard

Allowed mime type doesn't support .msg (Outlook) file

Open karthick-manoharan opened this issue 7 years ago • 12 comments

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"]

karthick-manoharan avatar May 23 '17 07:05 karthick-manoharan

In my case, I'm not able to upload any other format except for pdf.

allowedMimeType: [ "application/pdf", ]

Ekaanth avatar Dec 11 '17 12:12 Ekaanth

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 avatar Mar 29 '18 18:03 reddevilzee

@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.

koenvanderlinden avatar Mar 29 '18 19:03 koenvanderlinden

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.

reddevilzee avatar Apr 02 '18 20:04 reddevilzee

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 avatar Apr 03 '18 15:04 koenvanderlinden

@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 avatar Apr 03 '18 16:04 reddevilzee

@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.

koenvanderlinden avatar Apr 04 '18 05:04 koenvanderlinden

any updation for supporting .msg file

Bombay2018 avatar Nov 22 '18 14:11 Bombay2018

Would like to use this to upload .msg. Wondering if the issue has been resolved

sashanth654 avatar Jan 14 '20 22:01 sashanth654

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.

roopeshkumar avatar Jan 27 '20 14:01 roopeshkumar

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.

ksshafik avatar Aug 16 '20 06:08 ksshafik

@karthick-manoharan @ksshafik is there any work around for this issue? are you able to upload file with .msg type?

nishchithas avatar Jul 19 '21 15:07 nishchithas