Closed nzambello closed 3 years ago
@AmineBlel which version on react-csv-reader are you using? Do you confirm that the issue is about the type of the files the browser allow you to load?
@AmineBlel I just tested the demo on Chrome and it works correctly. Do you have the same issue with the demo on CodeSandBox?
@nzambello, I'm using react-csv-reader 3.0.4, and yes with Chrome it gives me the chance to upload files with other extensions like pdf, but with Firefox, it shows just csv files to upload. even in the demo I have the same problem
I had to change the console.dir
line to console.log
to see the results in the demo
The accept
prop is mapped to the element, so it's basic HTML stuff.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file
If you read MDN docs, you'll see:
The accept attribute doesn't validate the types of the selected files; it simply provides hints for browsers to guide users towards selecting the correct file types. It is still possible (in most cases) for users to toggle an option in the file chooser that makes it possible to override this and select any file they wish, and then choose incorrect file types.
I tested on Chrome on Linux and using other browsers and OS, so I can guarantee that the default file type is csv, but the user is able to select other type of files by selecting different kind of filters like "All type of files".
Hi, is there a workaround to enforce csv upload only?
@chrys-exaucet take a look at #55 I'm merging and releasing that as soon as tests are fulfilled (and passing)
@chrys-exaucet check https://github.com/nzambello/react-csv-reader/releases/tag/v3.3.0
Thanks @nzambello, I 'll try it out ASAP.
Hi guys, still got the same problem, it works correctly on Firefox, but with Chrome no.
I'm using ubuntu 18.04
Originally posted by @AmineBlel in https://github.com/nzambello/react-csv-reader/issues/9#issuecomment-602728899