Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MIME type of file returning empty in javascript on some machines

Tags:

javascript

I have a javascript snippet written which checks for the mime type of the files.

var type = this.files[0].type;

Code was running fine for a long time but now somehow its not able to find value of file type.

I checked in browser's debug tool and find mime type of file is blank.

Issues is happening on some machines only and running fine on others, although both machines are running on Windows 10 and using same version of google chrome (version 68.0.3440.84).

Any idea?

like image 226
Manoj-kr Avatar asked Aug 07 '18 10:08

Manoj-kr


People also ask

What is the Mimetype of a file?

A media type (also known as a MIME type) is a two-part identifier for file formats and format contents transmitted on the Internet. The Internet Assigned Numbers Authority (IANA) is the official authority for the standardization and publication of these classifications.

Do all files have MIME type?

There are too many issues with MIME types on different operating systems, different applications saving files differently, some files not having a MIME at all, and lastly, the fact that the extension and MIME could be altered by a malicious user or program.


1 Answers

Finally, i got the answer for my question and here is reason why this was happening on some machines.

As i was expecting, issue is system specific where content-type for .csv type is missing under Registry (HKEY_CLASSES_ROOT.csv).

See screenshot, This entry was missing on some machines.

This was missing on some machines

like image 141
Manoj-kr Avatar answered Oct 03 '22 01:10

Manoj-kr