define ("FILEREPOSITORY","./");
if (isset($_FILES['homework'])) {
if (is_uploaded_file($_FILES['homework']['tmp_name'])) {
if ($_FILES['homework']['type'] != "application/pdf") {
echo "Homework must be uploaded in PDF format.
";
} else {
$today = date("m-d-Y");
if (! is_dir(FILEREPOSITORY.$today)) {
mkdir(FILEREPOSITORY.$today);
}
$name = $_POST['name'];
$result = move_uploaded_file($_FILES['homework']['tmp_name'], FILEREPOSITORY.$today."/"."$name.pdf");
if ($result == 1)
echo "File successfully uploaded.
";
else
echo "There was a problem uploading the homework.
";
}
}
}
?>