problem description
I want to check out all the selected files, but I can only check out one
at a time.the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
state = {
fileName: "",
filesLen: "",
}
changeFile = () = > {
const { schema } = this.props;
const _id = schema.id;
initUpload({
buttonId: _id,
**onAddFiles: (files) => {this.setState({filesLen: files.length})},**
onProgress: (file) => {console.log(file.percent + "---" + file.name)},
**onSucc: (file) => {this.setState({ fileName: file.name })},**
onFail: (errMsg) => (alert(errMsg)),
})
}
render () {
const { hiddenTitle, schema, name, root, value } = this.props;
const { getFieldDecorator } = this.props.form;
const fileName = this.state.fileName;
const filesLen = this.state.filesLen;
const _fileNum = schema.fileNum;
const labelProps = {colon: false};
return <Form.Item {...labelProps}>
{getFieldDecorator(name, {
rules: [{ required: schema.required, message: "" + schema.title }]
})(
<div>
<Button icon="upload" id={schema.id}></Button>
{fileName}
</div>
)}
</Form.Item>
}
}
what result do you expect? What is the error message actually seen?
I want to get all the values of my selected file and the length of the selected file array, but after each selection, the next selection will overwrite the previous one
like this, you can only choose one at a time. If you want to choose more than one, how can I improve it?