multi file download with one click

J

Jedrin

I'm interested in finding out if it's possible to have javascript fire
off multiple file downloads. I realizes using a zip file is a good
option here, but I have been asked to investigate if it can be done
individually without a zip file. I have google searched a bit and
found some stuff, though it's not totally clear what the answer is. If
it can't be done, that's fine I just need to know ..

Thanks
 
T

Thomas 'PointedEars' Lahn

Jedrin said:
I'm interested in finding out if it's possible to have javascript fire

There is no "javascript". What are your target environments?
off multiple file downloads. I realizes using a zip file is a good
option here, but I have been asked to investigate if it can be done
individually without a zip file. I have google searched a bit and
found some stuff, though it's not totally clear what the answer is.

There is seldom only one answer. What have you searched for (keywords) and
what have you found that needs clarification?
If it can't be done, that's fine I just need to know ..

It can be done. It can be done without client-side scripting, too.

<http://jibbering.com/faq/#posting>


PointedEars
 
S

S.T.

I'm interested in finding out if it's possible to have javascript fire
off multiple file downloads. I realizes using a zip file is a good
option here, but I have been asked to investigate if it can be done
individually without a zip file. I have google searched a bit and
found some stuff, though it's not totally clear what the answer is. If
it can't be done, that's fine I just need to know ..

Thanks

If you want more of an out-of-the-box solution with a built-in UI, at
the expense of being a bit 'heavy', you can look at something like:

http://www.plupload.com/example_queuewidget.php

However it's going to require the user's browser have at least one of
Flash, Silverlight or Gears installed -- or be a newer browser with some
of the new HTML5 features available.
 
M

Mike Duffy

It can be done. It can be done without client-side scripting, too.

And in the "extreme" example (virus propagation), multiple file downloads
can be done without even the end user's participation.
 
J

Jedrin

In answer to what environment I have, it is ruby on rails server
running on linux. I think it has the standard prototype javascript
library which has ajax support. I've used jquery before as well.

That plupload looks like multiple file upload where as I am looking
for multiple file download.

My google search was something like 'javascript multiple file
download', but I did it at work so I can't be sure exactly and I am at
home currently. I found an example that did a window.open() inside of
a setTimeout(). I've done a bit of javascript, but I'm not a wiz. I
reasoned that if it was easy to do that, you could create viruses that
did that which I had not seen too many like that .. I know there is
some cross sute scripting you can do, but not sure how complicated it
should have to be ..
 
T

Thomas 'PointedEars' Lahn

Jedrin said:
In answer to what environment I have, it is ruby on rails server
running on linux.

You have a part client-side, part server-side problem, so the client-side
environment matters, too.
I think it has the standard prototype javascript library
which has ajax support.

Whatever you mean by this.
I've used jquery before as well.

Definitely client-side now. And dump jQuery while you still can.
That plupload looks like multiple file upload where as I am looking
for multiple file download.

As I said, IIUC, you do not need scripting to do this, if you serve a
document with several iframes where each triggers a file download. With
client-side scripting, though, you can append those `iframe' elements
dynamically by which you could, therefore, trigger multiple downloads with
only one click (however, the user will have to confirm each download
separately by default).
My google search was something like 'javascript multiple file
download', but I did it at work so I can't be sure exactly and I am at
home currently.

Your message headers indicate you do have Web access at home, too.
I found an example that did a window.open() inside of a setTimeout().

The obvious and workable solution are separate views because they can
access a different resource each; whether you should be using iframes or
popup windows depends mostly on the client-side target environments: popup
windows are blocked in more recent browsers (by now regardless of
setTimeout(), BTW), iframes are not; however, iframes are not as well
supported in less recent browsers, while popup windows are. Popup windows
also tend to leak memory; allocated memory is not (always) (immediately)
(fully) freed when the window is closed. And there are general usability
issues, too.
I've done a bit of javascript, but I'm not a wiz. I reasoned that if it
was easy to do that, you could create viruses that did that which I had
not seen too many like that ..

The virus would be only "good" if it would also open/run the downloaded
file without asking. While there are exploits to do this, they usually
depend on security leaks in third-party software (like the Acrobat/Adobe
Reader browser plugin; by coincidence, I have heard in an IT Security
lecture yesterday of a real-world example how the Mebroot rootkit could
install itself in the MBR by downloading and running an .exe file from a
bogus PDF document viewed in there).


PointedEars
 
J

Jedrin

Thanks,

I see that with IFrames this is easy to do, something that never
occurred to me. There is no way to get around that the user has to
confirm each and every download ?
 
T

Thomas 'PointedEars' Lahn

Jedrin said:
I see that with IFrames this is easy to do, something that never
occurred to me. There is no way to get around that the user has to
confirm each and every download ?

Not by default, fortunately.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top