PHP ZipArchive addFile stopped working -


i have following code running quite time now:

$thisdir = "$_server[document_root]/webroot/uploads/user_uploaded_files/";      if( !empty( $files ) ){       $destination = 'uploads/zip_files/meeting_' . $meetingid .'.zip';       $zip = new ziparchive();       $zip->open( $destination, ziparchive::create | ziparchive::overwrite );       //add uploaded files ( $file = filename.ext )           foreach( $files $file ){               if(file_exists( $thisdir . $file )){                  $zip->addfile('/uploads/user_uploaded_files/' . $file, $file);           } } 

however, had stopped working (not sure of previous, current version 7.0.9 ).

foreach loop runs previously, file_exists returns true, no files being added archive.

did experience too? or guidance appreciated.

you should test if $zip->open worked :

$res = $zip->open($destination, ziparchive::create | ziparchive::overwrite); if ($res) {     foreach ($files $file) {         if (file_exists($thisdir . $file)) {             $zip->addfile('/uploads/user_uploaded_files/' . $file, $file);         }     } } 

you add

error_reporting(e_all); ini_set('display_errors', true); 

at beginning of script, , see if there error.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -