Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
184 views
in Technique[技术] by (71.8m points)

javascript - Set file download destination using ExtJs

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...