I have currently implemented uploading a single file to my react app, but want to upload multiple files, below is the code I am using to upload a single file. Is it possible to upload multiple files?
captureFile = (event) => {
const file = event.target.files[0]
const reader = new window.FileReader()
reader.readAsArrayBuffer(file)
reader.onloadend = () => {
this.setState({
buffer: Buffer(reader.result),
file: URL.createObjectURL(file),
})
}
}
This is what I am trying to do at the moment
captureFile = (event) => {
const files = event.target.files
for (let i = 0; i < files.length; i++) {
const file = files[i]
const reader = new window.FileReader()
reader.readAsArrayBuffer(file)
reader.onloadend = () => {
this.setState({
buffer: Buffer(reader.result),
file: URL.createObjectURL(file),
})
}
}
multipleprop if you are using defaultinput