php - creating zip of big folder with pdf files -
i'm creating zip of folder pdf , txt files, working well. creating zip of folder above 30 files ( 389 kb each file) getting empty zip. why?
here's code:
include("include/zip_min.inc"); if($_get['create_zip']) { include("include/zip_min.inc"); $zipfile = new zipfile(); $files_arr=scandir($_get['path']); foreach ($files_arr $folder) { if(( strpos("-".$folder,".pdf") || strpos("-".$folder,".txt") ) )//&& $k<30 { $k++; $fileonserver = $_get['path']."/".$folder;//"path/to/file/oldfilename.txt"; $filename =$folder; $zipfile -> addfile(file_get_contents($fileonserver), $filename); } } // force download zip header("content-type: application/octet-stream"); header("content-disposition: attachment; filename=test.zip"); echo $zipfile -> file(); }
Comments
Post a Comment