Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. Warning: ZipArchive::close(): Invalid or uninitialized Zip object
  2.  
  3. foreach( glob($sourcedir.'*.[zZ][iI][pP]') as $zippath)
  4. {
  5. // create daily zip file
  6. $zipname = preg_replace('~'.$sourcedir.'~','',$zippath);
  7. $zipname2 = preg_replace('~.zip~','',$zipname);
  8.  
  9. $zip = new ZipArchive();
  10. $ret = $zip->open($xmlzip.$zipname2.'_contact_xml.zip', ZipArchive::OVERWRITE);
  11.  
  12. // move xml files to daily zip file created above
  13. if ($ret !== TRUE) {
  14. printf('Failed with code %d', $ret);
  15. } else {
  16. foreach(glob($source_file_path.'*.[xX][mM][lL]') as $xmlpath){
  17. $zip->addFile($xmlpath, preg_replace('~'.$source_file_path.'~','',$xmlpath));
  18.  
  19. }
  20. }
  21.  
  22. $zip->close();
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement