Last active
August 13, 2016 12:13
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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