Monday, June 4, 2012

Unzip with PHP

     if(!class_exists('ZipArchive')) die('ZipArchive missing');
     $zip = new ZipArchive;
     $res = $zip->open('my_zip_file.zip');
     if ($res === TRUE) {
         $zip->extractTo('my_extract_to_dir/');
         $zip->close();
         echo 'ok';
     } else {
         echo 'failed';
     }

No comments:

Post a Comment