Reproduction link
Steps to reproduce
- I hava a accept attribute of Upload.Dragger component, now I need upload a file which extension doesn't match accept
- click to upload, beforeUpload triggered
- drag to upload, beforeUpload not triggered
What is expected?
drag to upload, beforeUpload also triggered
What is actually happening?
drag to upload, beforeUpload not triggered
| Environment | Info |
| ------------ | ------------ |
| antd | 4.21.4 |
| React | 18.2.0 |
| System | win10 |
| Browser | edge 102 |
I want to do some checking work on beforeUpload hook. but when drag file into box, beforeUpload not triggered.
7条答案
按热度按时间bqjvbblv1#
same issue not solved at 2019. #17090
w8rqjzmb2#
#30403
pjngdqdw3#
#30403 (comment)
我是 windows系统,可以选择非 accept 文件,此时 beforeUpload 还是没有触发的。
https://github.com/react-component/upload/pull/329/files 看起来没有解决这个问题
yebdmbv44#
any update on this?
iklwldmw5#
@afc163 目前添加 accept 属性,Dragger 拖入非 accept 的文件没有走到 beforeUpload,有什么方案可以处理下
tnkciper6#
@afc163 目前添加 accept 属性,Dragger 拖入非 accept 的文件没有走到 beforeUpload,有什么方案可以处理下
+1 当用户拖入非 accept 的文件,目前是没有任何反应的。我想要弹出message(例如”该类型文件不支持“),好像没法实现。只有onDrop会触发,但onDrop里只有DragEvent,没有file的信息。
nhhxz33t7#
可以在
DragEvent
中拿到 file