I want to make my user select any type of files listed and make them as a zip folder and download it. The files may be .doc,.jpeg,.ppt, etc
            Asked
            
        
        
            Active
            
        
            Viewed 1.6k times
        
    1 Answers
7
            you can take a look at ZipArchive, you would be able to create zips with that and let the user download it. 
Cletus provide a really good answer there. I humbly copy his sample here
$files = array('readme.txt', 'test.html', 'image.gif');
$zip = new ZipArchive;
$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);
- 
                    ok ragez i ll give a try – ACP Nov 19 '09 at 05:24
- 
                    class ZipFile not found... I got this error – ACP Nov 19 '09 at 05:30
 
     
     
    