Advertisement
reenadak

extract zip

Feb 20th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1.     public function extractZip($zipName, $newLocation) {
  2.         $zip = new ZipArchive;
  3.    
  4.         if ($zip->open($zipName) === TRUE) {
  5.             if (substr($newLocation, -1) != '/')
  6.                 $newLocation .= '/';
  7.            
  8.             if (!file_exists($newLocation))
  9.                 mkdir($newLocation);
  10.            
  11.             return $zip->extractTo($newLocation);
  12.             $zip->close();
  13.         }
  14.        
  15.         return false;
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement