Created
May 22, 2014 13:38
-
-
Save mr-fan/09bd5423ed738b26d6c4 to your computer and use it in GitHub Desktop.
Unzip on Server - Serv you time!
This file contains 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 | |
$file = 'name_of_the_file.zip'; | |
$path = pathinfo(realpath($file), PATHINFO_DIRNAME); | |
$zip = new ZipArchive; | |
$res = $zip->open($file); | |
if ($res === TRUE) { | |
$zip->extractTo($path); | |
$zip->close(); | |
echo "$file extracted to $path"; | |
} else { | |
echo "I couldn't open $file"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment