title: Contact form not sending but getting the file upload
body: <p>I have a contact form with a file upload included in it. The contact form is in a hover box. It has a file upload attached, I get the file in my folder but I do not get the email. Could someone please help me figure this out. Thank you very much for any and all help you all can give me.
  I have a contact form with a file upload included in it. The contact form is in a hover box. It has a file upload attached, I get the file in my folder but I do not get the email. Could someone please help me figure this out. Thank you very much for any and all help you all can give me.
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;?php
  
   //Settings
  $max_allowed_file_size = 100; // size in KB
  $allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
  //Validations
  if($size_of_uploaded_file &gt; $max_allowed_file_size )
  {
    $errors .= "\n Size of file should be less than $max_allowed_file_size";
  }
  //------ Validate the file extension -----
  $allowed_ext = false;
  for($i=0; $i&lt;sizeof($allowed_extensions); $i++)
  {
    if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
    {
      $allowed_ext = true;
    }
  }
  if(!$allowed_ext)
  {
    $errors .= "\n The uploaded file is not supported file type. ".
    " Only the following file types are supported: ".implode(',',$allowed_extensions);
  }
  
    if(!empty($_FILES['uploaded_file']))
    {
      $path = "uploads/";
      $path = $path . basename( $_FILES['uploaded_file']['name']);
     $email_to = "contest@capebretoncares.com";
      $email_subject = "Add my Fur Baby to Cape Breton Cares";
   if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
         
  header("Location: https://www.capebretoncares.com/p/thank-you-image/");
      } else{
          echo "There was an error uploading the file, please try again!";
      }
    }
    
  ?&gt;
  
  &lt;?php
  if(isset($_POST['email'])) {
   
   
       
   
      $first_name = $_POST['first_name']; // required
      $last_name = $_POST['last_name']; // required
      $email_from = $_POST['email']; // required
      $subject = $_POST['subject']; // required
      $uploaded_file = $_FILES['uploaded_file']; // required
      $comments = $_POST['comments']; // required
   
      $error_message = "";
      $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
   
    if(!preg_match($email_exp,$email_from)) {
      $error_message .= 'The Email Address you entered does not appear to be valid.&lt;/br&gt;';
    }
   
      $string_exp = "/^[A-Za-z .'-]+$/";
   
    if(!preg_match($string_exp,$first_name)) {
      $error_message .= 'The First Name you entered does not appear to be valid.&lt;/br&gt;';
    }
   
    if(!preg_match($string_exp,$last_name)) {
      $error_message .= 'The Last Name you entered does not appear to be valid.&lt;/br&gt;';
    }
   
   if(!preg_match($string_exp,$subject)) {
      $error_message .= 'The Subject you entered does not appear to be valid.&lt;/br&gt;';
    }
    
    if(strlen($comments) &lt; 2) {
      $error_message .= 'The Comments you entered do not appear to be valid.&lt;/br&gt;';
    }
   
    if(strlen($error_message) &gt; 0) {
      died($error_message);
    }
   
      $email_message = "Form details below.\n\n";
   
       
      function clean_string($string) {
        $bad = array("content-type","bcc:","to:","cc:","href");
        return str_replace($bad,"",$string);
      }
   
      $email_message .= "First Name: ".clean_string($first_name)."\n";
      $email_message .= "Last Name: ".clean_string($last_name)."\n";
      $email_message .= "Email: ".clean_string($email_from)."\n";
      $email_message .= "Subject: ".clean_string($subject)."\n";
      $email_message .= "Image: ".clean_string($uploaded_file['name'])."\n";
      $email_message .= "Comments: ".clean_string($comments)."\n";
   
  // create email headers
  $headers = 'From: '.$email_from."\r\n".
  'Reply-To: '.$email_from."\r\n" .
  'X-Mailer: PHP/' . phpversion();
  @mail($email_to, $email_subject, $email_message, $headers);  
  ?&gt; 
  &lt;?php
   
  }
  ?&gt;</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.furbc {
  cursor: pointer;
  }
  
  .toolstip {
  display: inline-block;
  position: relative;
  }
  
  .toolstip .toolstiptext {
  background-color: rgba(0, 0, 0, 0.36);
  border-radius: 5px;
  border-top: 4px solid #da291c;
  color: #ffffff;
  font-family: Netflix Sans,Helvetica,Arial,sans-serif;
  font-size: 15px;
  font-weight: 400;
  left: 50%;
  margin-left: -285px;
  margin-top: 1px;
  opacity: 1;
  padding: 10px ;
  position: absolute;
  text-align: left;
  visibility: hidden;
  width: 275px;
  z-index: 1;
  }
  
  .toolstip:hover .toolstiptext {
  visibility: visible;
  }
  
  .furbcf form {
  display: flex;
  position: relative;
  width: 100%;
  }
  
  .furbcf input[type=text] {
  border: 1px solid #C2C2C2;
  border-radius: 5px;
  box-sizing: border-box;
  color: #242527; 
  font-family: Netflix Sans,Helvetica,Arial,sans-serif;
  font-size: 15px;
  font-weight: 300;
  margin: 0px 0px;
  padding: 5px 5px;
  width: 175px;
  }
  
  .furbcf input:focus { 
  border: 1px solid #da291c;
  border-radius: 5px;
  outline: none;
  }
  
  .furbcf textarea {
  border: 1px solid #C2C2C2;
  border-radius: 5px;
  box-sizing: border-box;
  color: #242527; 
  font-family: Netflix Sans,Helvetica,Arial,sans-serif;
  font-size: 15px;
  font-weight: 300;
  margin: 0px 0;
  padding: 5px 5px;
  width: 175px;
  }
  
  .furbcf textarea:focus {
  border: 1px solid #da291c;
  border-radius: 5px;
  outline: none;
  }
  
  .furbcf input[type="submit"] {
  background-color: #ffffff;  
  border: 2px solid #da291c;   
  border-radius: 5px;
  box-sizing: border-box; 
  color: #da291c; 
  cursor: pointer;
  font-family: Netflix Sans,Helvetica,Arial,sans-serif;
  font-size: 15px;
  font-weight: 300; 
  outline: none;
  padding: 5px;  
  width: 100px;   
  }
  
  .furbcf input[type="submit"]:hover {
  background-color: #da291c;    
  border: 2px solid #da291c; 
  border-radius: 5px;
  box-sizing: border-box; 
  color: #ffffff;  
  cursor: pointer;
  font-family: Netflix Sans,Helvetica,Arial,sans-serif;
  font-size: 15px;
  font-weight: 300;
  padding: 5px;    
  width: 100px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form class="furbcf" method="post" action="send_contact.php" enctype="multipart/form-data"&gt;
  &lt;label for="first_name"&gt;First Name: &lt;font color="red"&gt;*&lt;/font&gt;&lt;/label&gt;
  &lt;/br&gt;
  &lt;input type="text" id="first_name" name="first_name" autocomplete="off" required&gt;
  &lt;/br&gt;
  &lt;/br&gt;
  &lt;label for="last_name"&gt;Fur Babies Name: &lt;font color="red"&gt;*&lt;/font&gt;&lt;/label&gt;
  &lt;/br&gt;
  &lt;input type="text" id="last_name" name="last_name" autocomplete="off" required&gt;
  &lt;/br&gt;
  &lt;/br&gt;
  &lt;label for="email"&gt;Email: &lt;font color="red"&gt;*&lt;/font&gt;&lt;/label&gt;
  &lt;/br&gt;
  &lt;input type="text" id="email" name="email" autocomplete="off" required&gt;
  &lt;/br&gt;
  &lt;/br&gt;
  &lt;input type="file" name="uploaded_file"autocomplete="off" required&gt;
  &lt;/br&gt;
  &lt;/br&gt;
  &lt;input type="submit" name="Submit" value="Submit"&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>