使用 ExtJs 设置文件下载目的地 [英] Set file download destination using ExtJs

查看:26
本文介绍了使用 ExtJs 设置文件下载目的地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ExtJs 进行前端开发,我正在寻找一种方法来设置要下载的文件的目的地.我知道我可以使用 xtype:filefield 来浏览文件,但这需要我选择一个实际的文件,我只需要为文件目的地选择一个文件夹,然后将该路径发送到其他地方.有什么办法可以做到吗?

I am using ExtJs for front end development and I am looking for a way to set the destination for a file to be downloaded. I know I can use xtype:filefield to browse files, but that requires me to select an actual file, I just need to select a folder for the file destination and then send that path elsewhere. Any way I can do that?

推荐答案

您将无法使用 javascript 选择用户的下载位置.这个只能从用户端设置,否则会危害用户安全.

You will not be able to choose the user's download location with javascript. This can only be set from the user's end, otherwise it would violate user's security.

如果您的应用仅用于内联网,您可以通过多种方式将配置推送到用户的浏览器上(取决于他们在内联网中运行的网络浏览器).但这将使所有下载都转到该位置.

If your app is for an intranet only there are various ways you can push a config onto the user's browsers (depending on which web browser they are running in the intranet). But that would make ALL downloads go to that location.

大多数浏览器还具有允许用户为每次下载定义位置的配置,如此处这里有针对不同浏览器的更多细节.用户将能够(并且必须)为每次下载选择下载位置.

Most browsers also have a configuration that allow the user to define a location for every download as covered here and here's more specifics for different browsers. The user would be able to (and have to) select the download location for every download.

如果这是针对内部网应用程序,并且您的内部网正在运行 Firefox,则还有 这个附加组件.您必须将其推送到所有用户的计算机上(或手动将其安装在所有计算机上).我还没有尝试过,但我计划在出现​​像您这样的情况时使用它(我所有的 ExtJS 工作都是针对运行 Firefox 的内部网 - 每当用户登录到网络时,我都会使用登录脚本推出这样的东西自动安装它们).

If this is for an intranet app, and if your intranet is running Firefox, there is also this add-on. You would have to push it out to all your user's computers (or manually install it on them all). I haven't tried it yet but I was planning on using it should a situation like yours arise (all my ExtJS work is for an intranet running Firefox - I push out things like this using a logon script whenever a user logs into the network to automatically install them).

这篇关于使用 ExtJs 设置文件下载目的地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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