Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-Type: text/text");
- ############################################################################
- # Simple PHP Upload Script for ShareX v0.1
- # Copyright (C) 2013 Richard Cornwell
- # Website: http://thegeekoftheworld.com/
- # Script: http://thegeekoftheworld.com/using-a-php-upload-script-for-sharex/
- # Email: richard@techtoknow.net
- #
- # This program is free software: you can redistribute it and/or
- # modify it under the terms of the GNU General Public License as
- # published by the Free Software Foundation, either version 3 of the
- # License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses>.
- ############################################################################
- $key = "CHANGEME";
- $uploadhost = "http://upload.domain.tld/";
- $redirect = "http://domain.tld/";
- #Comment this next line if you want Robots to index this site.
- if ($_SERVER["REQUEST_URI"] == "/robot.txt") { die("User-agent: *\nDisallow: /"); }
- #Don't edit past this point!
- if (isset($_POST['k'])) {
- if ($_POST['k'] == $key) {
- $target = getcwd() . "/" . basename($_FILES['d']['name']);
- if (move_uploaded_file($_FILES['d']['tmp_name'], $target)) {
- $md5 = md5_file(getcwd() . "/" . basename($_FILES['d']['name']));
- rename(getcwd() . "/" . basename($_FILES['d']['name']), getcwd() . "/" . $md5 . "." . end(explode(".", $_FILES["d"]["name"])));
- echo $uploadhost . $md5 . "." . end(explode(".", $_FILES["d"]["name"]));
- } else {
- echo "Sorry, there was a problem uploading your file.";
- }
- } else {
- header('Location: '.$redirect);
- }
- } else {
- header('Location: '.$redirect);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement