“文件对话框取消”事件在JavaScript中 [英] "On file dialog cancel" event in JavaScript

查看:81
本文介绍了“文件对话框取消”事件在JavaScript中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件输入:

 < input type = file id = file onchange ='foo(this.files )'/> 

函数'foo'仅在用户在文件上传对话框中选择某个文件时调用,并单击确定。用户点击对话框中的取消按钮时是否会触发任何事件?
只有HTML5的解决方案才行。

解决方案

我认为如果您可以更改一下代码,正在添加插件来添加文件,例如:



http:// swfupload.org/





http://www.uploadify.com



这些比较常见,我会与首先,我没有任何问题。



这不会完全符合您的要求,但您可以在队列中添加文件,然后取消它们,并且可以捕获此事件...



我知道这不是你要找的东西,但是我可以给你的最好的解决方案



祝你好运!我希望我已经帮助你

I have a file input:

<input type=file id=file onchange='foo(this.files)'/>

Function 'foo' is called only when user chooses some file in the file upload dialog and clicks "OK". Is there any event that will be fired when user clicks "cancel" button in the dialog? HTML5-only solutions are OK.

解决方案

I think that the best way if you can change a bit your code, is adding plugins to add files, for example:

http://swfupload.org/

or

http://www.uploadify.com

these are the more common, I'd work with the first and I had no problems.

This will not do exactly what you want, but you can add files in a queue and then cancel them, and you can capture this event...

I know that is not what you was looking for, but is the best solution I can give you

good luck! I hope I've helped you

这篇关于“文件对话框取消”事件在JavaScript中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆