Reputation: 77
I'm having difficulty on getting all the file name I dropped; I only get the first dropped item name but I needed all the names so i can upload it all. Here is the sample of my dropzone:
onDrop(acceptedFiles) {
debugger
console.log('Received files: ', acceptedFiles);
this.setState({files: acceptedFiles});
let {form} = this.props.timeline;
acceptedFiles.map(file => {
form.Name=file.name
});
}
and here is what happens in the dropzone debugged
Upvotes: 0
Views: 114
Reputation: 771
Your acceptedFiles
already contains all the filenames but the filename is encapsulated inside the object which also seems to contain the TimelineKey
as well.
If you only want the filenames then you need to modify your code a bit:
const filenames = acceptedFiles.map(file => (file.name))
Then you have the collection of filenames and you can do what ever you want with it.
Upvotes: 1