Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple file download  RSS feed

 
Jeramie Maratas
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Im facing a dilemma at the moment. Can anyone figure out how to download multiple files? My initial solution was to use: "window.open()" in javascript and then call the page that downloads by looping. Unfortunately, the window that is opened does not close even after the download ends. My client does not want this to happen. Even if I invoke the window.close(), the window still does not close.
Here is a code snippet:
***************************************************************************
for (i=0; i<iNoOfElements; i++) {
fileName = "fileID" + i;
fileID = document.getElementById(fileName).value;
window.open("Download.jsp?filename=" + fileID, "down", "width=1, height=1");
***************************************************************************
Now, can anyone suggest a new method? Another way would be to zip the files but my client does not want it either.
Any help is very much appreciated. You can reach me through j_maratas@yahoo.com.
Thank you and best regards.

Jen
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you are out of luck!

I would say zipping the files saves bandwidth which means saves them money.

Only thing I would say to try is this:

and see if it does not mess with the download.

Eric
 
Jeramie Maratas
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help..
But i used a different approach and it worked. What i did was i created several iframes depending on how many files to download. Then, when the client clicks the download button, i have a javascript that iterates and sets the source ("src") of those iframes into another JSP that handles the download.
Here is a sample code:
for (i=0; i<iNoOfElements; i++) {
if (document.getElementById && document.getElementById(getIDOf) != null) {document.getElementById(getIDOf).src = "Download.jsp?filename=" + fileID;
}
else if (document.layers && document.layers[getIDOf] != null) {
document.layers[getIDOf].src = "Download.jsp?filename=" + fileID;
}
else if (document.all) {
document.all[getIDOf].src = "Download.jsp?filename=" + fileID;
}
}
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!