Skip to content

Instantly share code, notes, and snippets.

@Mattlk13
Forked from joseporiol/unzip.php
Created September 4, 2018 05:32
Show Gist options
  • Save Mattlk13/25c30f7d97147aa1f836b425261a3d6c to your computer and use it in GitHub Desktop.
Save Mattlk13/25c30f7d97147aa1f836b425261a3d6c to your computer and use it in GitHub Desktop.
Unzip file
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