valor-software / ng2-file-upload

Easy to use Angular components for files upload
http://valor-software.github.io/ng2-file-upload/
MIT License
1.91k stars 663 forks source link

Not working correctly allowedMimeType: ['text/plain', 'text/csv'] #850

Open spwizard opened 7 years ago

spwizard commented 7 years ago

I only want users to be able to upload .csv files. I first implemented 'text/csv' which on a max/osx worked fine, but on windows chrome, it will not allow users to upload .csv files. I assume its because it docent recognise css. I tried a work around of allowing .txt files but this on windows chrome will still only allow txt extensions.

How can I get windows chrome to accept csv files only

Ekaanth commented 6 years ago

when I provide mime-type for pdf it is uploading but when I provide for doc and docx documents are not getting uploaded. Is there a way around to tackle this problem. (Till this issue is fixed).

public allowedMimeType = [''application/pdf'']; uploader: FileUploader = new FileUploader({ allowedFileType: this.allowedMimeType, isHTML5: true });

this code is working perfectly fine, but when I provide mime type for doc and docx it's not working as it supposed to be.

mime-type provided for doc and docx file.

.doc application/msword .docx application/vnd.openxmlformats-officedocument.wordprocessingml.document

MrfksIv commented 6 years ago

I am facing the same problem. I believe it has something to do with the file type that microsoft office opposes on .csv files. After checking the file details that I attempted to upload I noticed that the type was of application/vnd.ms-excel instead of text/csv:

{
  lastModified: 1496154311657,
  lastModifiedDate: Tue May 30 2017 17:25:11 GMT+0300 (GTB Daylight Time) {},
  name: "a173916a-64bf-46e6-8d21-05a4b7dae381.csv",
  size: 29310,
  type: "application/vnd.ms-excel",
  webkitRelativePath: ""
}
UrielMiranda commented 6 years ago

My configuration for csv files only, in Mac/Windows, works fine in both @spwizard thanks to @MrfksIv for his explain

public uploader: FileUploader = new FileUploader(
    {
      url:  @''
      allowedMimeType: ['application/csv', 'text/csv', 'application/vnd.ms-excel']
   }
);
TheMorne commented 1 year ago

Just in case someone is trying to use the "allowedMimeType" to allow .mov files.

Try allowedMimeType: ['video/quicktime']

took me quite a while to get this info