Skip to content

Instantly share code, notes, and snippets.

@famoser
Last active August 13, 2016 12:13
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 famoser/c0b02a0e7fdc412b15615527c6daf551 to your computer and use it in GitHub Desktop.
Save famoser/c0b02a0e7fdc412b15615527c6daf551 to your computer and use it in GitHub Desktop.
Extract a zip file online. Cleans up afterwards (deletes zip and this script). Can be used as a fast and simple deploy option, without using too much bandwidth
<?php
$files = glob("*.zip");
if (count($files) == 0) {
echo "no zip files found";
exit;
}
else if (count($files) > 1) {
echo "multiple zip files found";
exit;
}
$zip = new ZipArchive;
$zip->open($files [0]);
$zip->extractTo('./');
$zip->close();
unlink("index.php");
unlink($files[0]);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment