Alberto Boz
Alberto Boz

Reputation: 13

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?

Upvotes: 0

Views: 167

Answers (1)

Quentin
Quentin

Reputation: 944002

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.

Upvotes: 0

Related Questions