Skip to content

Instantly share code, notes, and snippets.

@mboomaars
Created March 12, 2012 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mboomaars/2020631 to your computer and use it in GitHub Desktop.
Save mboomaars/2020631 to your computer and use it in GitHub Desktop.
PHP: Unzip zip files
function unzip_file( $file, $destination )
{
// create object
$zip = new ZipArchive() ;
// open archive
if ( $zip->open( $file ) !== TRUE ) {
die ( "Could not open archive" );
}
// extract contents to destination directory
$zip->extractTo( $destination );
// close archive
$zip->close();
echo 'Archive extracted to directory';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment