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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -