what is the exact mimetype for doc and docx while using ng2FileSelect
Currently, I'm using ng2FileSelect
for my file uploading in angular 4 projects. I looked up on the internet for the mime-type for allowing doc and docx, after What is a correct mime type for docx, pptx etc? reading through this, I made my changes as per the answer. But still, I'm facing the problem and I'm still unable to upload doc and docx files. Is there any other possible way to do so using ng2FileSelect
.
code
public allowedMimeType = ['application/pdf','application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];
attachment: FileUploader = new FileUploader({
allowedMimeType: this.allowedMimeType,
});
this code is helping me only in the upload of pdf files, not with doc and docx.
Thanks in advance.
I have the same problem with ng2-file-upload
(and I think it can be multer
problem, not ng2-file-upload
). But when i download .docx
, my app understand it not like application/vnd.openxmlformats-officedocument.wordprocessingml.document
, but like application/octet-stream
.
I can't find 'right' solution and can't answer why it happened, but when I start to use application/octet-stream
in my MIME checking - all works fine (for .doc
, .docx
and etc.)
You can read about application/octet-stream
on MDN https://developer.mozilla.org/ru/docs/Web/HTTP/Basics_of_HTTP/MIME_types#Discrete_types
I think it less security solution, but it working and it better than nothing :)
链接地址: http://www.djcxy.com/p/7954.html