YUI Uploader - 如何判断所有文件何时已上传?
我正在使用 YUI 2 Uploader 上传一些文件。我的用户将上传多个文件,因此我想使用 YUI Uploader 的“文件队列”。这一切都成功了。我在上传文件时禁用上传器,因此人们在开始上传文件后无法将新文件添加到队列中。
当所有文件上传完毕后,我想(用 JavaScript)做一些事情。 YUI Uploader 会在某些文件上传时发出信号,但在队列中的所有文件都已上传时不会发出信号。有没有办法检测所有文件何时上传?
I'm using the YUI 2 Uploader to upload some files. My users will be uploading more than one file, so I want to use YUI Uploader's 'file queue'. That is all working successfully. I disable the uploader when the files are uploading, so people can't add new files to the queue once they start uploading the files.
I want to do something (in JavaScript) when all the files have been uploaded. The YUI Uploader has signals for when certain files are uploaded, but not when all files in the queue have been uploaded. Is there some way to detect when all the files have been uploaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
保留文件和文件的对象(或数组)在 uploadComplete 处理程序中删除刚刚完成的文件。如果没有剩余,请调用您的上传完成函数。
这里的示例实现, http://tivac.com/upload/upload.js 它有一些错误但解决了这个特殊问题。
Keep an object (or array) of files & in the uploadComplete handler remove whichever file just finished. If there are none left call your upload finalize function.
Example implementation here, http://tivac.com/upload/upload.js It has some bugs but solves this particular problem.
为 uploadcomplete 事件创建一个事件处理程序。
看一下 yui 上传器文档:
http://developer.yahoo.com/yui/docs/YAHOO。 widget.Uploader.html
http://developer .yahoo.com/yui/examples/uploader/uploader-advanced-queue.html
Create an eventhandler for the uploadcomplete event.
Take a look at the yui uploader documentation:
http://developer.yahoo.com/yui/docs/YAHOO.widget.Uploader.html
http://developer.yahoo.com/yui/examples/uploader/uploader-advanced-queue.html