Skip to content

Instantly share code, notes, and snippets.

Created November 27, 2012 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4155885 to your computer and use it in GitHub Desktop.
Save anonymous/4155885 to your computer and use it in GitHub Desktop.
Upload script
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/var/www/upload/';
$uploadfile = $uploaddir . basename($_FILES['uploaded'].['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:<br>';
print_r($_FILES);
echo "<br>";
print_r($uploadfile);
print "</pre>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment