I put this questions in reference POST a file with React.js
I would like now to send a list of files to the endpoint.
My input component:
<input onChange={(e) => Actions.uploadXLS(e.target.files)} multiple type="file" name="xlsz" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" style={{ display: 'none' }}/>
The action handler:
uploadXLS(files) {
let i = 0;
const data = new FormData();
for ( i = 0; i < files.length; i++ ) {
data.append( 'file' , files[i]);
}
console.log(data);
this.getInstance().callUploadXLS( data );
}
console prints: FormData{}