/ Published in: PHP
Expand |
Embed | Plain Text
/*************************************************** * Function to unzip a file zipped with PHP's ZipArchive. * Parameters Expected: * $zip_file: The zip file (with path) we wish to unzip * $directory: Where we want the contents unzipped to **************************************************/ function unZipArchive($zip_file,$directory) { //create a new ZipArchive class $zip_archve = new ZipArchive(); //attempt to open the archive file $results = $zip_archive->open($zip_file); switch($results) { case TRUE: //format the directory properly //extract the files $zip_arvhive->extractTo($directory); //close the ZipArchive $zip_archive->close(); //Return True return true; break; case FALSE: return false; } }
You need to login to post a comment.
