react-dropzone / attr-accept

JavaScript implementation of the "accept" attribute for HTML5 input element
MIT License
110 stars 24 forks source link

Accept custom extensions like html file input #32

Closed larissa-n closed 1 week ago

larissa-n commented 5 years ago

In <input type='file'>, the fact that you can use the accept prop for random extensions (like accept='myext') is rather handy for all those that create and use proprietary file types.

Getting into react-dropzone, is it true that this example by @export-mike (copied below) is currently the best shot?

Pseudo code:

< ... accept="" onDrop={file => {
 if(!file.name.endsWith('.csv')) { this.setState({ rejected: true }) }
 // doSomething();
} >

Are there any plans for extending the accept prop in the same way file inputs work? When users browse files, it's nice to have them filtered by the extension(s) that'll work.

Thank you!

rolandjitsu commented 1 week ago

@larissa-n there have been a lot of changes in react-dropzone. I suggest checking out the latest version and see if that suits your needs.

Gonna close this for now.