Fix upload beforeUpload, close #3001

This commit is contained in:
afc163 2016-09-12 15:19:44 +08:00
parent 472821013c
commit c897243d33
2 changed files with 2 additions and 8 deletions

View File

@ -12,6 +12,7 @@ import { Upload, Button, Icon, message } from 'antd';
const props = {
action: '/upload.do',
multiple: true,
beforeUpload(file) {
const isJPG = file.type === 'image/jpeg';
if (!isJPG) {

View File

@ -84,8 +84,6 @@ export default class Upload extends React.Component {
}
onStart = (file) => {
if (this.recentUploadStatus === false) return;
let targetItem;
let nextFileList = this.state.fileList.concat();
if (file.length > 0) {
@ -182,11 +180,6 @@ export default class Upload extends React.Component {
this.handleRemove(targetItem);
}
beforeUpload = (file) => {
this.recentUploadStatus = this.props.beforeUpload(file);
return this.recentUploadStatus;
}
handleRemove(file) {
let fileList = this.removeFile(file);
if (fileList) {
@ -242,7 +235,7 @@ export default class Upload extends React.Component {
onError: this.onError,
onProgress: this.onProgress,
onSuccess: this.onSuccess,
beforeUpload: this.beforeUpload,
beforeUpload: this.props.beforeUpload,
};
let uploadList;
if (this.props.showUploadList) {