Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2. header("Content-Type: text/text");
  3.  
  4. ############################################################################
  5. #    Simple PHP Upload Script for ShareX v0.1
  6. #    Copyright (C) 2013  Richard Cornwell
  7. #    Website: http://thegeekoftheworld.com/
  8. #    Script:  http://thegeekoftheworld.com/using-a-php-upload-script-for-sharex/
  9. #    Email:   richard@techtoknow.net
  10. #
  11. #    This program is free software: you can redistribute it and/or
  12. #    modify it under the terms of the GNU General Public License as
  13. #    published by the Free Software Foundation, either version 3 of the
  14. #    License, or (at your option) any later version.
  15. #
  16. #    This program is distributed in the hope that it will be useful,
  17. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. #    GNU General Public License for more details.
  20. #
  21. #    You should have received a copy of the GNU General Public License
  22. #    along with this program. If not, see <http://www.gnu.org/licenses>.
  23. ############################################################################
  24.  
  25. $key = "CHANGEME";
  26. $uploadhost = "http://upload.domain.tld/";
  27. $redirect = "http://domain.tld/";
  28.  
  29. #Comment this next line if you want Robots to index this site.
  30. if ($_SERVER["REQUEST_URI"] == "/robot.txt") { die("User-agent: *\nDisallow: /"); }
  31.  
  32. #Don't edit past this point!
  33. if (isset($_POST['k'])) {
  34.     if ($_POST['k'] == $key) {
  35.         $target = getcwd() . "/" . basename($_FILES['d']['name']);
  36.         if (move_uploaded_file($_FILES['d']['tmp_name'], $target)) {
  37.             $md5 = md5_file(getcwd() . "/" . basename($_FILES['d']['name']));
  38.             rename(getcwd() . "/" . basename($_FILES['d']['name']), getcwd() . "/" . $md5 . "." . end(explode(".", $_FILES["d"]["name"])));
  39.             echo $uploadhost . $md5 . "." . end(explode(".", $_FILES["d"]["name"]));
  40.         } else {
  41.             echo "Sorry, there was a problem uploading your file.";
  42.         }
  43.     } else {
  44.         header('Location: '.$redirect);
  45.     }
  46. } else {
  47.     header('Location: '.$redirect);
  48. }
  49. ?>