Created
January 27, 2019 07:08
-
-
Save AzureDoom/90e016b884185804d7c4e7d06cb5e8fa to your computer and use it in GitHub Desktop.
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 | |
if (isset($_GET['zipName'])){ | |
$fName = $_GET['zipName']; | |
}else{ | |
$fName = null; | |
} | |
if (isset($fName)){ | |
$zip = new ZipArchive; | |
if ($zip->open($fName) === TRUE) { | |
$path = pathinfo(realpath($fName), PATHINFO_DIRNAME); | |
$zip->extractTo($path); | |
$zip->close(); | |
unlink($fName); | |
header("location: ExtractZip.php?Status=0"); | |
}else{ | |
header("location: ExtractZip.php?Status=1&LastTry=".$fName); | |
} | |
}else{ | |
echo '<br><br><center>'; | |
if (isset($_GET['Status'])){ | |
if ($_GET['Status'] == 1){ | |
echo '<h1>Cannot find '.$_GET["LastTry"].' Try again.</h1><br>'; | |
}else{ | |
echo '<h1>Success!.</h1><br>'; | |
} | |
} | |
echo ' | |
<form method="get"> | |
<input type="text" name="zipName" value="zipfile.zip"> | |
<input type="submit" value="Unzip"> | |
</form></center>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment