title: How to get the file type of a CSV in jQuery
body: <p>This is the input tag that I am using to select a file,</p>
  
  <pre><code>&lt;input id="imprtUpldFileInpt"  name="file" type="file"/&gt;
  </code></pre>
  
  <p>And this is how I process the file details with jQuery,</p>
  
  <pre><code>var file = $("#imprtUpldFileInpt")[0].files[0];
  var f_name = file.name;
  var f_size = file.size;
  var f_type = file.type;
  var fileMimeTypeArr = ["text/comma-separated-values", "text/csv", "application/csv", "application/vnd.ms-excel"];
  var fileTypePos = $.inArray(f_type, fileMimeTypeArr);
  </code></pre>
  
  <p>I am checking whether the selected file is a csv or not with the value of <code>fileTypePos</code>. If the value is greater than or equal to 0, then I conform that it is a csv file. But I am facing a problem in getting the file type. </p>
  
  <p>If a csv is selected, the file name and size are obtained correctly. But I am not getting the file type. </p>
  
  <p>The following screenshot shows the file details of a csv file,
  <a href="https://i.stack.imgur.com/j6jXS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j6jXS.png" alt="enter image description here"></a></p>
  
  <p>I have added the possible mime types in <code>fileMimeTypeArr</code> for checking whether the file is a csv file or not. The problem is with getting the file type.</p>
  
  <p>This problem does not occur if the csv file is saved in a machine that has MS Excel installed. But if a csv file is created/saved in a machine that does not have MS Excel, then this problem occurs.</p>
  
  <p>Why the file type has ""?</p>