可以下载多个文件。 [英] Multiple files are avaliable to download.

查看:66
本文介绍了可以下载多个文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在客户端,我有一个超链接,点击它我将其重定向到MVC控制器的动作方法。在Action方法中,我返回File()(FileResult),然后在IE上打开文件保存/下载框。现在如果我在链接上多次点击而不关闭保存/下载框,它将不会打开多个保存/下载框。

问题在于firefox和chrome。如果我从浏览器点击相同的链接,可以下载多次文件。有什么办法我可以确定该文件已经可以下载(直到用户没有下载/取消下载),所以我可以修改我的客户端逻辑,用户将无法下载多个文件。

On client side i've one hyper link and on click of it I redirect it to the MVC controller's action method. In Action method I return File() (FileResult), which in turn open the file save/download box on IE. Now if i click multiple times on the link without closing the save/download box, it will not open multiple save/download box.
Problem is with firefox and chrome. If i click on the same link from browser, multiple times file will be available for download. Is there any way by which I can identify that file is already available to download (until user has not downloaded/cancelled the download) so i can modify my client logic and user will not be available with multiple files to download.

推荐答案

我不太确定,您是否可以控制下载文件夹,仍然需要对其进行一段时间的研究。



为了快速修复,我建议你在点击按钮后禁用它。

因此,它会阻止用户多次点击它。

我在网站上经常看到这种类型的实现。
I am not so sure, whether you can have control over the Download Box, still research over it for some time.

For a quick fix, I would suggest you to disable the Button, once it is clicked.
As a result, it will prevent the user from clicking it many times.
I have seen this type of implementation in websites a lot.


这篇关于可以下载多个文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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