I am using react-dropzone for multiple image upload. The image upload is working but the upload progress is not showing. I could not find on the documentation clearly about showing upload progress. How can we show upload progress in react-dropzone?
I have created a codesandbox too. Here is the link
https://codesandbox.io/s/8BEmjLmo
Here is the code too
onDrop = (accepted, rejected) => {
this.setState({
accepted,
rejected
});
};
showFiles() {
const { accepted } = this.state;
return (
<div>
<h3>Dropped files: </h3>
<ul className="gallery">
{accepted.map((file, idx) => {
return (
<div className="col-md-3" key={idx}>
<li>
<img
src={file.preview}
className="img-fluid img-responsive"
width={200}
alt={file.name}
/>
<i
className="fa fa-remove"
onClick={e => this.handleRemove(file)}
/>
<div className="imageName">{file.name}</div>
</li>
</div>
);
})}
</ul>
</div>
);
}
render() {
const { accepted } = this.state;
return (
<div style={styles}>
<Hello name="CodeSandbox" />
<Dropzone
onDrop={this.onDrop}
style={style}
activeStyle={activeStyle}
multiple
accept="image/*"
>
Try Dropping file
</Dropzone>
{accepted.length !== 0 && this.showFiles()}
</div>
);
}
}