Posted By

julioantuneztarin on 06/17/11


Tagged

php files unzip


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

boksiora


Unzip files in PHP


 / Published in: PHP
 

  1. <?php
  2. $zip = zip_open("zip.zip");
  3.  
  4. if (is_resource($zip)) {
  5.  
  6. while ($zip_entry = zip_read($zip)) {
  7. $fp = fopen("zip/".zip_entry_name($zip_entry), "w");
  8. if (zip_entry_open($zip, $zip_entry, "r")) {
  9. $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
  10. fwrite($fp,"$buf");
  11. zip_entry_close($zip_entry);
  12. fclose($fp);
  13. }
  14. }
  15.  
  16. zip_close($zip);
  17. }
  18. ?>

Report this snippet  

You need to login to post a comment.