Browse Source

Fix upload beforeUpload, close #3001

pull/3028/head
afc163 8 years ago
parent
commit
c897243d33
  1. 1
      components/upload/demo/beforeUpload.md
  2. 9
      components/upload/index.jsx

1
components/upload/demo/beforeUpload.md

@ -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) {

9
components/upload/index.jsx

@ -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) {

Loading…
Cancel
Save