mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
parent
6c77d336d9
commit
ee0bf41672
@ -180,13 +180,14 @@ export default class Upload extends React.Component<UploadProps, UploadState> {
|
||||
}
|
||||
|
||||
beforeUpload = (file: UploadFile, fileList: UploadFile[]) => {
|
||||
const newFile = fileToObject(file);
|
||||
if (!this.props.beforeUpload) {
|
||||
return true;
|
||||
}
|
||||
const result = this.props.beforeUpload(file, fileList);
|
||||
const result = this.props.beforeUpload(newFile, fileList);
|
||||
if (result === false) {
|
||||
this.onChange({
|
||||
file,
|
||||
file: newFile,
|
||||
fileList: uniqBy(fileList.concat(this.state.fileList), (item: any) => item.uid),
|
||||
});
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user