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

通过 File Api 来嗅探文件类型,而不仅是后缀名 #134

Open
donaldshen opened this issue Dec 11, 2019 · 0 comments
Open

通过 File Api 来嗅探文件类型,而不仅是后缀名 #134

donaldshen opened this issue Dec 11, 2019 · 0 comments

Comments

@donaldshen
Copy link
Contributor

Is your feature request related to a problem? Please describe.
目前组件通过判断文件后缀名 + accept 属性来限制用户上传。但后缀名是可以随意更改的。

Describe the solution you'd like
是否可以通过 File Api,来获取文件真正的类型来限制上传呢?

Describe alternatives you've considered
不过组件使用者只会传 accept 进来。组件内部能帮应用层面匹配的限制估计是有限的。比如 accept = image/*,那么文件类型是图片的就放行。肯定不是每一种 accept 都有较好对应的 File 类型。

Additional context
复杂的场景,其实是需要组件使用者通过 beforeUpload 钩子自行去做拦截判断的。

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

No branches or pull requests

1 participant