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

fix(Upload) Check file extension before upload and splice from file list #16836

Closed
ariunbatb opened this issue May 28, 2019 · 2 comments
Closed
Labels

Comments

@ariunbatb
Copy link
Contributor

What i want

I want upload only image and show upload list.

Problem

Problem is even if you use "beforeUpload" client still can select wrong extension file.

Annotation 2019-05-28 160829
When you write "beforeUpload" function and uploads wrong extension file it still appear in upload list.
Annotation 2019-05-28 155143

Environment

any

Solution💡

So we need to check extension in "onChange"

handleChange= (info) => {
info.fileList.filter(file => file.type !== "image/jpeg")
.map((file, idx) => info.fileList.splice(idx, 1));
....
}

@ant-design-bot
Copy link
Contributor

Hello @ariunbatb, 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!

你好 @ariunbatb,为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。你可以通过 issue 助手 来创建 issue 以方便我们定位错误。谢谢配合!

@dseljan
Copy link

dseljan commented Jun 28, 2019

Hi. I've just found this bug in my project.
In my opinion, if beforeUpload returns false, it shouldn't touch the fileList. Behaviour before this bug #8036 worked as supposed to.

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