From c897243d334068f2475036fd628619f5911f83c2 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 12 Sep 2016 15:19:44 +0800 Subject: [PATCH] Fix upload beforeUpload, close #3001 --- components/upload/demo/beforeUpload.md | 1 + components/upload/index.jsx | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/components/upload/demo/beforeUpload.md b/components/upload/demo/beforeUpload.md index ca06510fae..acd8bf13d3 100644 --- a/components/upload/demo/beforeUpload.md +++ b/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) { diff --git a/components/upload/index.jsx b/components/upload/index.jsx index ed162dd88c..7fce1b6d64 100644 --- a/components/upload/index.jsx +++ b/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) {