if($_POST['submit'])
{
if(($_POST['fname']) && ($_POST['lname']) &&($_POST['gender']) && ($_POST['address']) && ($_POST['city']))
{
$target_path = "resumes/";
$path_parts = pathinfo(basename($_FILES['resume']['name']));
$upload_file_name = time() . "." . $path_parts['extension'] ;
$target_path = $target_path . $upload_file_name;
if(move_uploaded_file($_FILES['resume']['tmp_name'], $target_path))
{
$fname1 = $_POST['fname'];
$lname1 = $_POST['lname'];
$gender1 = $_POST['gender'];
$address1 = $_POST['address'];
$city1 = $_POST['city'];
if($_POST['message'])
$message1 = $_POST['message'];
else
$message1 = "---";
$fileatt = $target_path; // Path to the file
$fileatt_type = "application/octet-stream"; // File Type
$fileatt_name = $fname1." Resume.".$path_parts['extension']; // Filename that will be used for the file as the attachment
$email_from = "SMS Invocare"; // Who the email is from
$email_subject = "Apply for position".$_GET['position']; // The Subject of the email
$email_to = "mayur@remotedataexchange.com"; // Who the email is too
$email_to1 = "ganesh.mepl@gmail.com"; // Who the email is too
// Message that the email has in it
$email_message = "Hello,
First Name : $fname1
last Name : $lname1
Gender : $gender1
Address : $address1
City : $city1
Message : $message1
";
$headers = "From: ".$email_from;
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message . "\n\n";
/********************************************** First File ********************************************/
$fileatt = $target_path; // Path to the file
$fileatt_type = "application/octet-stream"; // File Type
$fileatt_name = $fname1." Resume.".$path_parts['extension'];; // Filename that will be used for the file as the attachment
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}\n";
unset($data);
unset($file);
unset($fileatt);
unset($fileatt_type);
unset($fileatt_name);
@mail($email_to, $email_subject, $email_message, $headers);
@mail($email_to1, $email_subject, $email_message, $headers);
$result = "Applied successfully.";
}
else
{
echo "out";
}
}
else
{
$err = "Mark all mandetory fields";
$fname = $_POST['fname']."
";
$lname = $_POST['lname']."
";
$gender = $_POST['gender']."
";
$address = $_POST['address']."
";
$city = $_POST['city']."
";
$message = $_POST['message']."
";
}
}
?>