sarink / react-file-drop

React component for Gmail or Facebook -like drag and drop file uploader
https://www.sarink.net
176 stars 54 forks source link

Filter js Files #82

Closed renanmachad closed 2 years ago

renanmachad commented 3 years ago

Hello, if a client drop a js file this stop my server in nodejs, how i can filter this? Using this library?

sarink commented 2 years ago

Hello, you should be able to handle that easily in the onDrop function, something like this should work:

onDrop={(files, event) => {
  const jsFiles = files.filter(file => file.name.endsWith('.js'));
  console.log(jsFiles);
});
renanmachad commented 2 years ago

Hello, oh my god i don´t have thought about it.Thanks so much;