I use <input type="file" accept=".txt" /> with accept property. I set it to accept, for example, only .txt files. And it works well if you click on input and opens the chooser and you cannot upload files that not allowed by accept.
But, when you upload files by drag & drop it uploads any files ignoring accept.
Here is an example: https://codesandbox.io/s/floral-tdd-11wt9?file=/src/App.js
To reproduce the problem:
- drag any file from you Desktop, expect
.txt - move and drop into the input
- you'll see a file name (but it should not be uploaded)
Q: What is the best way to work this around? Considering there could any fileTypes and standard file.type gives excessive information about file type.