Last active
June 27, 2017 17:37
-
-
Save manishjaingit/91ab3b157ccd64984cf1a020c83729d6 to your computer and use it in GitHub Desktop.
for unzip the zip file on server
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 | |
// assuming file.zip is in the same directory as the executing script. | |
$file = 'file.zip'; | |
// get the absolute path to $file | |
$path = pathinfo(realpath($file), PATHINFO_DIRNAME); | |
$zip = new ZipArchive; | |
$res = $zip->open($file); | |
if ($res === TRUE) { | |
// extract it to the path we determined above | |
$zip->extractTo($path); | |
$zip->close(); | |
echo "WOOT! $file extracted to $path"; | |
} else { | |
echo "Doh! I couldn't open $file"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment