1

I am using the html5 input tag to multiselect only .csv files. I have so far

<input type="file" id="files" name="files[]" accept=".csv" multiple />

but when I click browse, it shows all file types. How can I get this to work?

Thanks.

omega
  • 30,811
  • 68
  • 188
  • 388

2 Answers2

5

Try:

<input id="fileSelect" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />

Or take a look at this solution.

Community
  • 1
  • 1
2

As per the docs, accept is used to specify mime types, not file extensions. Try accept="text/csv" instead.

Marc B
  • 340,537
  • 37
  • 382
  • 468