CodeIgniter Forums
Multiple file downloads using force_download() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Multiple file downloads using force_download() (/showthread.php?tid=12074)



Multiple file downloads using force_download() - El Forum - 10-04-2008

[eluser]tomgkelly[/eluser]
I'm developing an application that allows users to download files. The user selects files from a pseudo catalog and they're place in a cue. When the users decide they've selected what they need they hit the download button to download all the selected files.

Everything up to the download operation works fine, but when the download function executes, only the first file in the cue is downloaded.

I'm using the force_download() function (from the download helper) in a loop in conjunction with an array that supplies filenames etc. The loop executes through the first iteration and then exits after the force_download() call.

Anyone have any ideas?

Thanks in advance


Multiple file downloads using force_download() - El Forum - 10-04-2008

[eluser]Pascal Kriete[/eluser]
You can't send more than one file. The download helper calls exit() once it sends the file.
Imagine the mess a download with a lot of files would cause.

Is zipping them an option?


Multiple file downloads using force_download() - El Forum - 10-05-2008

[eluser]tomgkelly[/eluser]
They could conceivably wind up being fairly large files .... most likely mpg2 and mpg3, but yes I could zip them, but I don't think I'd gain any compression to speak of.

I notice the exit in the helper source and thought it might part of the problem, but commenting it out doesn't seem to effect things one way or another.

I may have to rethink downloads a bit and discuss things with my client.

Thanks for the input,

Tom