Sloaix / qiniu4js

🔥七牛上传SDK(浏览器环境)
MIT License
162 stars 34 forks source link

如何编程式添加(选择)文件? #33

Open solarhell opened 7 years ago

solarhell commented 7 years ago

你好,我在使用这个包实现拖拽上传,现在拿到 File 对象,希望做一些处理后编程式将文件push进去files的队列,请问该如何操作呢?因为我看好像只提供了弹出文件选择框的功能。 谢谢!

solarhell commented 7 years ago

其实就是不通过绑定dom 可以直接取到文件来上传吗?

Sloaix commented 7 years ago

不通过dom点击是取不到文件的,浏览器的安全机制,必须要是用户点击 type=file 的input元素才能弹出文件选择框。

solarhell commented 7 years ago

嗯 那请问如果我通过浏览器拖拽 取到文件后 有办法交给qiniu4js来处理吗

Sloaix commented 7 years ago

没有提供处理files的外部接口,需要新增,但是这几天我很忙 :( ,不过你可以提交pr : )

solarhell commented 7 years ago

src/upload/Uploader.ts 感觉主要是在这个文件 我尝试一下 不是很熟悉TS。 感谢回复 have a good day :-D

nmgwddj commented 6 years ago

同样希望有类似功能,我个人用 antd 比较多,antd 的 Upload 控件很完善也很丰富,但它的 Upload 控件都是自己点击或者拖曳选择文件的。能传递的也就是 files 信息。

Sloaix commented 6 years ago

目前不支持手动添加File对象到队列中,如果实在需要这个feature,只能自己fork改源码。我目前在找工作,没有时间维护。:(

2017-08-02 11:54 GMT+08:00 solarhell notifications@github.com:

你好,我在使用这个包实现拖拽上传,现在拿到 File 对象,希望做一些处理后编程式将文件push进去files的队列,请问该如何操作呢? 谢谢!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lsxiao/qiniu4js/issues/33, or mute the thread https://github.com/notifications/unsubscribe-auth/ACgYKb3DGy4QPgGMwIZ-2sTNzTaZIYfYks5sT_LegaJpZM4OqkZ_ .