Skip to content

Instantly share code, notes, and snippets.

@petecoop
Created October 29, 2012 09:59
Show Gist options
  • Save petecoop/3972694 to your computer and use it in GitHub Desktop.
Save petecoop/3972694 to your computer and use it in GitHub Desktop.
PHP - unzip to cwd
<?php
$zipfile = (isset($_GET['z'])) ? $_GET['z'] : false;
if($zipfile){
$zip = new ZipArchive;
$res = $zip->open($zipfile);
if($res === true){
$zip->extractTo('./');
$zip->close();
unlink(__FILE__);
}else{
echo "No file found!";
}
}else{
echo "File not specified";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment