Skip to content

Commit

Permalink
fix(FileUploader): respect multiple prop in default file uploader (#5492
Browse files Browse the repository at this point in the history
)
  • Loading branch information
emyarod authored and joshblack committed Mar 10, 2020
1 parent 7ccbc21 commit f126171
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions packages/react/src/components/FileUploader/FileUploader.js
Expand Up @@ -343,10 +343,14 @@ export default class FileUploader extends Component {

handleChange = evt => {
evt.stopPropagation();
const filenames = Array.prototype.map.call(
evt.target.files,
file => file.name
);
this.setState({
filenames: this.state.filenames.concat(
Array.prototype.map.call(evt.target.files, file => file.name)
),
filenames: this.props.multiple
? this.state.filenames.concat(filenames)
: filenames,
});
if (this.props.onChange) {
this.props.onChange(evt);
Expand Down
Expand Up @@ -76,7 +76,7 @@ function ExampleDropContainerApp(props) {
}));
props.multiple
? setFiles([...files, ...newFiles])
: setFiles([...files, newFiles[0]]);
: setFiles([newFiles[0]]);
newFiles.forEach(uploadFile);
},
[files, props.multiple]
Expand Down

0 comments on commit f126171

Please sign in to comment.