Convert file object

Close #9775
This commit is contained in:
Wei Zhu 2018-03-23 11:23:47 +08:00
parent 6c77d336d9
commit ee0bf41672

View File

@ -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;