Grammin Grammin - 2 years ago 111
Javascript Question

How can I let a user download multiple files when a button is clicked?

So I have a httpd server running which has links to a bunch of files. Lets say the user selects three files from a file list to download and they're located at:

When they click the download button I want them to download these three files from the links above.

My download button looks something like:

var downloadButton = new Ext.Button({
text: "Download",
handler: function(){
//download the three files here

Answer Source

The best way to do this is to have your files zipped and link to that:

The other solution can be found here: How to make a link open multiple pages when clicked

Which states the following:


<a href="#" class="yourlink">Download</a>


$('a.yourlink').click(function(e) {

Having said this, I would still go with zipping the file, as this implementation requires JavaScript and can also sometimes be blocked as popups.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download