Home » excel » excel – Dropzone show only CSV & XLS files in dialog box

excel – Dropzone show only CSV & XLS files in dialog box

Posted by: admin May 14, 2020 Leave a comment

Questions:

I used dropzone as CSV/XLS file uploader. I use this option to filter and restrict CSV/XLS file:

acceptedFiles: "text/csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",

Now I just see XLS file in windows dialog box and doesn’t see CSV file. Off course when I change filter drop-down to all files, I see CSV file and select it. But I wanna to method or option to solve this issue.

Do you have any solution for see both XLS/CSV files together?

How to&Answers:

Dropzone.js simply puts the values from the AcceptedFiles attribute directly into the html component.

<input accept="text/csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">

It looks like text/csv is not an accepted value even though it is a valid mime type. .csv is recommended.

See here HTML Input="file" Accept Attribute File Type (CSV).