Posted By

level09 on 08/18/09


Tagged


Versions (?)

Who likes this?

12 people have marked this snippet as a favorite

luman
unitechy
rickfu
fackz
umang_nine
ReeceMarsland
nb109
mecha
tewoos
sbcjr
bug5
tux-world


Unzip zip files


 / Published in: PHP
 

  1. function unzip_file($file, $destination){
  2. // create object
  3. $zip = new ZipArchive() ;
  4. // open archive
  5. if ($zip->open($file) !== TRUE) {
  6. die (’Could not open archive’);
  7. }
  8. // extract contents to destination directory
  9. $zip->extractTo($destination);
  10. // close archive
  11. $zip->close();
  12. echo 'Archive extracted to directory';
  13. }

Report this snippet  

You need to login to post a comment.