2097152) {
$errors[]='File size must be excately 2 MB';
}
// Check Allowed File Types
$file_ext=strtolower(end(explode('.',$_FILES['attachment']['name'])));
$extensions= array("pdf","doc","mp4","jpg");
if(in_array($file_ext,$extensions)=== false){
$errors[]="File extension not allowed, please choose a PDF, DOC, DOCX file.";
}
if(empty($errors)==true){
// Move the file from temporary location to determined location
if (!(move_uploaded_file($_FILES['attachment']['tmp_name'], $newname))) {
echo "
ERROR: A problem occurred during file upload!
\n";
} else {
echo "
The file has been saved as: {$newname}
\n";
}
}
else{
print_r($errors);
}
}
?>