Javascript Read Mime Type CSV Always Empty

I am currently struggling with a Windows browser to check a mimetype file csv. I tried checking it out through:

console.log($('#file')[0].files[0].type); // output: ""

But when I use the Linux browser, it works fine:

console.log($('#file')[0].files[0].type); // output: "text/csv"

How could this happen? Is there an alternative solution to this? Any help would be appreciated.

Here is my Windows + browser spec:

  • Chromium 50.0.2632.0
  • Windows 10 Pro 64-bit

Update 1

When I tried to upload a file jpg/ png/ of any image, Chromium can detect its mime-type.

Sorry, English is not my native.

+4
source share
1 answer

mime , , "". Internet Explorer mime .csv . . .csv IE. , , IE.

, file.type, . ( ), switch, .

mime , , , .

FileReader. . Javascript , , . .

+1

All Articles