-
-
Notifications
You must be signed in to change notification settings - Fork 794
Description
Do you want to request a feature or report a bug?
- I found a bug
- I want to propose a feature
- improve documentation
What is the current behavior?
The plugin 'looks' broken in recent browsers. We can't access file.path
If this is a feature request, what is motivation or use case for changing the behavior?
Browsers are hidding file path intentionally for security purpose.
If you want to access file content (don't bother trying to get the path, you can't get it). Use the FileReader API like so:
const reader = new FileReader();
reader.onload = () => {
const fileAsBinaryString = reader.result;
// do whatever you want with the file content
};
reader.onabort = () => console.log('file reading was aborted');
reader.onerror = () => console.log('file reading has failed');
reader.readAsBinaryString(file);
This sample uses es6 syntax and filereader api to read file content.
readAsBinaryString
is not the only method available, check the link above.
I think this should be added to the readme and the example should be updated as well.
Please mention other relevant information such as the browser version, Operating System and react-dropzone version.
react-dropzone 3.13.3 and 4.0.0
Google Chrome: 60.0.3112.90
OS: Windows