Page 1 of 1
download more than one file at a time
Posted: Mon Nov 08, 2004 6:18 pm
by sharyn
I'm looking to find a way to download multiple files at a time. I've got my user to a page where they can check multiple boxes and then click the "download these files(s)" button. Now what I'd to happen is that the files all download into some predetermined area (the user will have no choice as to where things get to download to)
I can't seem to google any kind of script to do this. Does anyone here know of a way to do this? Thanks in advance to all that answer
- sharyn
Posted: Mon Nov 08, 2004 6:35 pm
by josh
You cant force a file onto the user's machine, given that kind of ability some developer could write a script to download a virus to a users machine without their permission.
For multiple file downloads you could have each download open in a new window, for example when they check file 1 and file 2 the following code gets run:
use javascript to open download.php?file=1 and download.php?file=2 so they get 2 pop up windows
then download.php:
Code: Select all
<?php
header('Content-type: image/jpg'); // put the correct mime type for the file
output("$path/$img.jpg"); // put the path to the file
?>
Posted: Mon Nov 08, 2004 6:36 pm
by rehfeld
you could zip the files.
i know ive seen a few classes that make zipping files on the fly really easy.
Posted: Mon Nov 08, 2004 6:42 pm
by sharyn
jshpro2 & rehfeld,
Both answers sound pretty doable... let me see what I can do with them... Zipping sounds good since it's all one download and it would be a smaller file that they might possibly recieve than a lot of larger ones... I'll start googling php zipping. Thanks a mill you two
- sharyn
Posted: Mon Nov 08, 2004 6:46 pm
by josh
I was going to suggest zipping the files but I have no experience working with zip files with php so I didn't even know if it was possible... php continues to amaze me

Posted: Mon Nov 08, 2004 6:49 pm
by sharyn
This might do the trick : [
zlib ] Now all I have to do is figure out how to download one file
- sharyn
Posted: Tue Nov 09, 2004 1:20 am
by rehfeld
[*RESOLVED*]
Posted: Mon Nov 15, 2004 6:04 pm
by sharyn
ok all, I ended up using
Zend's zip class and it works great. Thanks for all your help.
- sharyn