Manoj-kr
Manoj-kr

Reputation: 806

MIME type of file returning empty in javascript on some machines

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?

Upvotes: 17

Views: 10418

Answers (3)

OutstandingBill
OutstandingBill

Reputation: 2862

My browser was complaining that mime type was empty for *.min.* files. In my case, this was because they didn't exist. I had to run gulp to create them.

Upvotes: 0

Slash90ITA
Slash90ITA

Reputation: 97

I also have the same problem with csv files with my Angular 8 application. The problem is only on the machine where Excel is not installed, so the csv key in the registry HKEY_CLASSES_ROOT is missing, as said by money user up here.

Upvotes: 1

Manoj-kr
Manoj-kr

Reputation: 806

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

Upvotes: 24

Related Questions