异步文件上传控件
我正在使用最新 AjaxControl ToolKit 中的新 AsyncFileUpload 控件。 我的查询是关于在上传开始之前触发的 OnClientUploadStarted 事件。有什么方法可以取消上传,因为我此时正在检查文件扩展名,并且想取消上传,以便它不会继续并继续上传文件。我的最终结果是只允许上传图像。 请提供建议并感谢您的宝贵时间。
I am using the new AsyncFileUpload control from the latest AjaxControl ToolKit.
My query is regarding the OnClientUploadStarted event which is fired before the upload is started. Is there any way to cancel the upload, as I am checking the fileExtension at this point and would like to cancel the upload so that it does not continue and go on to upload the file. My end result is allow only images to be uploaded.
Please advise and thanks for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
得到了答案,我所要做的就是用这个脚本覆盖 javascript 函数(不是最好的答案,但有效),你们都可以做得更快更干净
Got the answer, all I had to do was override the javascript function with this script(not the best answer, but works), you all could have done faster and cleaner
您可以尝试在该字段中添加“正则表达式验证器”,并查看是否可以使用它来验证在上传开始之前选择的文件。
You might try adding a "Regular Expression Validator" to the field, and see if you can use that to validate the file selected before the upload starts.
试试这个代码:
Try this code: