<?php
   if(isset($_FILES['image'])){
      $errors= array();
      $file_name = $_FILES['image']['name'];
      $file_size = $_FILES['image']['size'];
      $file_tmp = $_FILES['image']['tmp_name'];
      $file_type = $_FILES['image']['type'];
      $file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
      
      $expensions= array("jpeg","jpg","png","pdf","zip","7z");
      
      if(in_array($file_ext,$expensions)=== false){
         $errors[]="The extension of the file you selected is not allowed. Please choose a PDF, JPEG, PNG or ZIP file.";
      }
      
      if($file_size > 10485760) {
         $errors[]='Sorry. File size cannot exceed 10 MB.';
      }
      
      if(empty($errors)==true) {
         move_uploaded_file($file_tmp,"uploads/".$file_name); //The folder where you would like your file to be saved
         echo "Success";
      }else{
         print_r($errors);
      }
   }





// PHPMailer script below

$email = $_REQUEST['email'] ;
$name = $_REQUEST['name'] ;
$phone = $_REQUEST['phone'] ;
$message = $_REQUEST['message'] ;
require("phpmailer/PHPMailerAutoload.php");

$mail = new PHPMailer();

$mail->IsSMTP();

$mail->Host = "smtp.gmail.com";
$mail->Port = 587; //SMTP port

$mail->SMTPAuth = true; 

$mail->Username = "WKFS.InfoDev@gmail.com"; // SMTP username
$mail->Password = "20InfoDev17!"; // SMTP password
$mail->addAttachment("uploads/".$file_name);
$mail->From = $email;
$mail->SMTPSecure = 'tls'; 

$mail->addAddress("WKFS-InfoDevSupport@wolterskluwer.com", "InfoDev Support");
$mail->Subject = "InfoDev Feedback Received";
$mail->Body ="
Name: $name<br>
Email: $email<br>
Telephone: $phone<br><br><br>
Comments: $message";
$mail->AltBody = $message;

if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

echo "<script>alert('Message has been sent')</script>";
?>