Dropping Image not setting files to input.
See original GitHub issue<Dropzone onDrop={this.onDrop} className="drop-zone text-center" name="building_photo_1"
inputProps={{size: '30', required: "true"}}>
<i className="fa fa-upload fa-4x"/>
<div className="drop-zone-text">
{!this.state.fileNames ?<div>Select files to upload<p>or drag and drop photo files</p></div>
: <div>{this.state.fileNames}</div>}
</div>
</Dropzone>
Selecting files sets the files to the input perfectly, but when dropping the file the files are not being set to the input.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:19
Top Results From Across the Web
How to set file input value when dropping file on page?
The user drops the file in the preview-image-container . The file isn't submitted with AJAX, the user needs to submit the form which...
Read more >How To Make A Drag-and-Drop File Uploader With Vanilla ...
It's a known fact that file selection inputs are difficult to style the ... Drag-and-drop image uploader in action ... Setting Up Our...
Read more >Drag and Drop File Uploading - CSS-Tricks
No problems at all if drag & drop file upload is not supported. ... (IE and Firefox) do not allow setting the value...
Read more >Creating a ReactJS drag and drop file upload component
But we don't want our users to see that file input, because we don't live in the olden days. And we have no...
Read more >react-dropzone
Simple React hook to create a HTML5-compliant drag'n'drop zone for files. ... the props from getInputProps() , opening a file dialog will not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As far as I can tell, it’s not possible to set the files property on a file input using javascript, so this is not a bug in react-dropzone.
The way I ended up working around this issue is by submitting the form using fetch, and storing the files that were dropped in state and adding them to a FormData instance created from the form, e.g.:
@micchyboy237, not possible, as I explained above. It’s a limitation put in place by browsers for security.