" ;
print_r($_FILES);
echo "
";
if(empty($_FILES["thefile"]["name"])) {
// either the form is loading for the first time
// OR it was submitted with no file
// stop page and give user message
exit("error. no file.");
} else {
// there is an uploaded file from
// a form object named "thefile
echo "Received a file in the form object 'thefile'.
";
echo "file was named " .
$_FILES["thefile"]["name"] . "";
echo "file was first saved as a temp file at " .
$_FILES["thefile"]["tmp_name"] . "
";
echo "file was then moved with a move_uploaded_file() command to server path " ;
$path = $_SERVER['CONTEXT_DOCUMENT_ROOT'] . "/uploads/";
echo $path . "
";
move_uploaded_file($_FILES["thefile"]["tmp_name"], $path . $_FILES["thefile"]["name"]);
echo "
";
echo "Link to uploaded file: ";
echo "" .
$_FILES["thefile"]["name"] . "";
echo "
";
echo "
";
exit();
}
?>