异步文件上传控件
关于.net中的AsyncFileUpload控件,一旦我选择一个文件,该控件就会执行文件上传。我担心的是,一旦我选择一个文件,是否可以禁用上传,以便我可以使用提交按钮异步处理上传。
Regarding the AsyncFileUpload control in .net, the control will execute the file upload once i select a file. In my concern is, is it possible to disable the upload once i select a file so that i could process the upload asynchronously with a submit button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我知道这已经很旧了,但我为此绞尽脑汁了一段时间,所以对于任何可能感兴趣的人来说。
我的第一个想法是禁用控件下的文件输入。
我能够禁用该控件,但不幸的是,它停止工作。当服务器触发 AsyncFileUpload_UploadComplete 时,输入被禁用,因此没有文件可供读取。
我最终在控件顶部放置了一个半透明 png 并显示和隐藏它以使控件无法访问。
希望这有帮助。
I know this is old, but I beat my head on this for a while, so for whoever might be interested.
My first thought was to disable the file input underneath the control.
I was able to disable the control but unfortunately, it stopped working. When the server fired AsyncFileUpload_UploadComplete the input was diabled so there wasn't a file to read.
I ended up positioning a semi-transparent png on top of the control and showing and hiding it to make the control innaccesible.
Hope this helps.
简单的答案是否定的。我也遇到过类似的异步上传问题。我的建议是,如果您需要使用按钮控制上传、添加和删除选定的文件(稍后您可能会需要它)并使用一些 JavaScript 操作,请远离他。
搜索SWFUpload,是一个可以轻松与.NET集成的Flash组件。它提供了多个 JavaScript 选项和事件。 :D
检查以下链接:
官方网站
演示
Simple answer is No. I've had similar asyncupload issues just like those ones. My advice is to stay away from him if you need to control upload with a button, add and remove selected files (you will probably need this later on) and use some javascript manipulation.
Search for the SWFUpload, is a flash component that can be integrated with .NET with ease. It offers multiple javascript options and events. :D
Check the following links:
Official site
Demonstration
据我所知,
AsyncFileUpload
公开的唯一事件是UploadComplete
事件和UploadError
。没有专门公开手动启动上传功能的事件。也许 JavaScript 中的一些技巧可以做到这一点,但我以前没有见过这样的解决方法。As far as I know that the only event exposed by
AsyncFileUpload
is theUploadComplete
event andUploadError
. There aren't events specifically that expose functionality to manually initiate the upload. Perhaps some trick in JavaScript could do it but I have not seen such a workaround before.