Question:
PHP Multiple file download?
?
2011-02-25 14:26:13 UTC
Hi,

I know how to force download of a single file when visiting a page with PHP using header() and Content-type then printing the contents of the file but how can I do this to force the download of multiple files at once in an archive format such as ZIP?

Many Thanks,
Four answers:
2011-02-26 01:47:50 UTC
You can use the ZipArchive class to create a ZIP file and stream it to the client. Something like:



$files = array('readme.txt', 'test.html', 'image.gif');

$zip = new ZipFile;

$zip->open('file.zip', ZipArchive::CREATE);

foreach ($files as $file) {

$zip->addFile($file);

}

$zip->close();



and to stream it:



header('Content-Type: application/zip');

header('Content-disposition: attachment; filename=filename.zip');

header('Content-Length: ' . filesize($zipfilename));

readfile($zipname);



The second line forces the browser to present a download box to the user and prompts the name filename.zip. The third line is optional but certain (mainly older) browsers have issues in certain cases without the content size being specified.
2016-12-12 15:59:51 UTC
Download Multiple Files Php
?
2016-04-15 14:07:03 UTC
If you pondering in studying landscaping this https://tr.im/FJNFJ is the first stage so that you can start understanding the best way feasible this beautiful and rewiring field.

Ideas 4 Landscaping have produced a special resource to inspire you layout your area. Furthermore, it’s all about photos. Large, detailed, illustrative pictures and depictions that you can view, examine, and go back to and adapt and make your very own. This is how skilled artists operate, drawing inspiration from photographs from other nations and other times. You can go for exotic, standard, American, retro, futuristic, classical or extremely bizarre: but in all circumstances, unique to you.

This is how this guide, Tips for landscaping functions.
2016-10-17 01:14:18 UTC
i don't think of there's a putting to have the flexibility to try this. i've got tried interior the previous too. i've got continuously loaded the torrent (with all information) then precise clicked - do not receive those i don't go with to d/l yet - then reloaded the torrent to get the subsequent one and so. that's a discomfort interior the **** yet i could not hit upon a manner of doing what you're attempting to realize the two.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...