I'm posting some code below, with code commented out, that is confusing the heck out of me. I'm attempting to validate if a file has been chosen for attachment in an email form, but it always returns 0 or none, no matter what type of file I choose. Can anyone point out my mistake?
print_r($HTTP_POST_FILES);
// Read POST request params into global vars
$id = $_POST['id'];
//$to = "jobs@wow-corp.com";
$to = "eatley@wow-corp.com";
$subject = "Web Application: " . $_POST['jobinfo'] . " (" . $_POST['reqnum'] . ")";
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$addlinfo = $_POST['addlinfo'];
// Obtain file upload vars
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_size = $_FILES['fileatt']['size'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$headers = "From: $name";
//Validate all fields are filled in first
if ($name <= "") {
$warning = "Please enter your name.";
}
else if ($email <= "") {
$warning = "Please enter your email.";
}
//else if ($fileatt_size == 0 || $fileatt = 'none') {
// $warning = "Please attach your resumé.";
//}
if ($warning) {// If we've set a message with a warning about their form entry...
echo $warning;
appform();
}
else { //no warnings
//now look to see what type of file is being uploaded
/*
if($userfile_type != 'application/msword') {
echo "This is not a valid file type (not .doc).";
exit;
} else {
echo "This is a valid file type (.doc).";
exit;
}
*/
Thanks so much,
Eve