jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes Downloading multiple files on a single button click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Downloading multiple files on a single button click" Watch "Downloading multiple files on a single button click" New topic
Author

Downloading multiple files on a single button click

Ishu Saxena
Greenhorn

Joined: Jun 24, 2008
Posts: 25
Hi Ranchers,

I'm trying to achieve a functionality to download multiple files on a single button click. What I have done for now is that I've used a JQuery plugin that does this:

http://biesiad.github.com/multiDownload/



This seems to do just what was intended (triggering the click event for all links) and thereby starting the downloads. However, for every download initiated, it would open a 'Save as...' download box where I need to specify a location for this download.
Now, for a large number of files, this becomes a problem. Wondering if it would be possible to just ask for the download location for the first file and rest of the files in that batch get saved to the same location? (I understand this would be a security concern and most likely would not be possible).

Tweaking the browser settings would achieve something similar but it would not ask for the download location in the first place and would save in the default location specified.

Here's a summary of what is required:

1) User clicks on a link to download a batch of files.
2) The first download is initiated asking for a location to save the file.
3) All subsequent files are saved to the same location.

Any pointers in the right direction would be very helpful. I'll then try to take it forward from there.

Appreciate your time and inputs.

--<br />SCJP 5.0
Ishu Saxena
Greenhorn

Joined: Jun 24, 2008
Posts: 25
Could not find how to edit my OP.
Just a couple of pointers:

1) I'm using Spring framework 3.0.5.
2) Bundling the individual files into a zip archive is not an option.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

Not possible.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

I don't know if this is related, but I think this behavior could also be tied dow to your browser preferences.
I use chrome and have configured it to use the Downloads folder. I never get asked where to download. However, for multiple downloads, I do get a confirmation dialog which says something like "This site is attempting to download multiple files".


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Ishu Saxena
Greenhorn

Joined: Jun 24, 2008
Posts: 25
Thanks Maneesh and Bear.
Maneesh, yes, this is something that is primarily determined by browser preferences. I was probably looking for a way to somehow override this behavior so that it is consistent across all browsers.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Maybe you might want to consider serving the files in a zipped format so it's one download.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

As I said it is not possible to override browser settings. Thank goodness. Imagine the security nightmare if you could.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Downloading multiple files on a single button click