简体   繁体   中英

HTML file upload don't recognize Keynote mime type

I'm uploading files to my Angular application using just HTML and JS. It works perfectly with all kind of files except for the Keynote ones.

I got the right name and size, but the type field is empty.

I've a simple file upload form like this:

<input type="file" class="d-none" (change)="addAttachments()" multiple #fileUpload />

When I check the file info, I got the correct 'type' for all kinds of file (images, documents, etc...) expect for the Keynote ones where it is empty.

My Angular code is like that

  addAttachments(): void {
    const files: FileList | null = this.fileUpload.nativeElement.files;
    if (files) {
      Array.prototype.forEach.call(files, (file) => {
           >>> file.type = ''
      }
    }
  }

Any idea of why keynote mime type is not recognized?

Any idea of why keynote mime type is not recognized?

Because it isn't on your browser's map of file extensions to MIME types.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM