Posted By

dubogii on 05/17/11


Tagged

files zip unzip


Versions (?)

Unzip Files


 / Published in: PHP
 

URL: http://css-tricks.com/snippets/php/unzip-files/

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

Report this snippet  

You need to login to post a comment.