Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上传使用handleUpload返回的false为什么文件还会显示出来呢 #9248

Closed
mayunyi opened this issue Feb 4, 2018 · 3 comments
Closed
Labels

Comments

@mayunyi
Copy link

mayunyi commented Feb 4, 2018

//zip附件上传
    uploadProps = {
        name: 'file',
        action: `${FILE_API}/api/user/files/`,
        headers: {
            authorization: 'authorization-text',
        },
        data(file) {
            return {
                name: file.name,
                a_file: file,
                category:1,
            };
        },
        beforeUpload(file) {
            if(file.type == ""){
                if(file.name.indexOf(".zip") == -1 && file.name.indexOf(".ZIP") == -1){
                    message.error('只能上传zip文件!');
                    return false;
                }else{
                    return true;
                }
            }else{
                const valid = file.type === 'application/zip';
                if (!valid) {
                    message.error('只能上传zip文件!');
                }
                return valid;
            }
        },
        onChange: (values) => {
            const {file} = values;
            if (file.status === 'done') {
                this.fileChange({
                    "filename":file.name,
                    "fileurl":file.response.a_file
                });
            }
            this.setState({
                filelist:values.fileList
            });
        },


    };

image
我上传的是一个png照片但是还是现实出来的!
请问是什么情况这块的代码都动过,之前是好的!

@ant-design-bot
Copy link
Contributor

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.
See: #4897

@ant-design-bot
Copy link
Contributor

Hello @mayunyi, your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue, thank you!

@afc163
Copy link
Member

afc163 commented Feb 6, 2018

trace #8020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants