[php]

if($_POST[“temail”]==null)
{
wp_redirect( home_url() );
exit;
}

add_filter(‘wp_mail_from_name’, ‘so17635785_from_name’);
function so17635785_from_name($name)
{
return ‘Martial Art Kits’;
}
$Qcode = “Query Code QP-” . rand(1000,10000);
$tname = $_POST[“tname”];
$temail = $_POST[“temail”];
$tquantity = $_POST[“tquantity”];
$tmeasurement = $_POST[“tmeasurement”];
$theight = $_POST[“theight”];
$twidth = $_POST[“twidth”];
$tsaddress = $_POST[“tsaddress”];
$tedate = $_POST[“tedate”];
$tfile = $_POST[“file”];
$tainfo = $_POST[“tainfo”];
$tshape = $_POST[“tshape”];
$email_to = “sales@martialartkits.com”; // The email you are sending to (example)
$email_from = “Martial Art Kits“; // The email you are sending from (example)
$email_subject = $Qcode; // The Subject of the email

$allowedExts = array(“gif”, “jpeg”, “jpg”, “png”);
$temp = explode(“.”, $_FILES[“file”][“name”]);
$extension = end($temp);
if ((($_FILES[“file”][“type”] == “image/gif”)
|| ($_FILES[“file”][“type”] == “image/jpeg”)
|| ($_FILES[“file”][“type”] == “image/jpg”)
|| ($_FILES[“file”][“type”] == “image/pjpeg”)
|| ($_FILES[“file”][“type”] == “image/x-png”)
|| ($_FILES[“file”][“type”] == “image/png”))
&& in_array($extension, $allowedExts))
{
if ($_FILES[“file”][“error”] > 0)
{
echo “Return Code: ” . $_FILES[“file”][“error”] . “
“;
}
else
{
//echo “Upload: ” . $_FILES[“file”][“name”] . “
“;
// echo “Type: ” . $_FILES[“file”][“type”] . “
“;
//echo “Size: ” . ($_FILES[“file”][“size”] / 1024) . ” kB
“;
// echo “Temp file: ” . $_FILES[“file”][“tmp_name”] . “
“;

move_uploaded_file($_FILES[“file”][“tmp_name”],
“wp-content/uploads/” . $_FILES[“file”][“name”]);
// echo “Stored in: ” . “wp-content/uploads/” . $_FILES[“file”][“name”];

}
$path_of_uploaded_file=”http://www.martialartkits.com/wp-content/uploads/” . $_FILES[“file”][“name”];
}
else
{
$path_of_uploaded_file = “No File Attached”;
// echo “Invalid file”;
}

$vmessage = $vmessage . “” . $Qcode . “\n”;
$vmessage = $vmessage . “User patches Query Information Details \n”;
$vmessage = $vmessage . “==================================================================\n”;
$vmessage = $vmessage . “Name : ” . $tname . “\n”;
$vmessage = $vmessage . “Email : ” . $temail . “\n”;
$vmessage = $vmessage . “Quantity : ” . $tquantity . “\n”;
$vmessage = $vmessage . “Measurement : ” . $tmeasurement . “\n”;
$vmessage = $vmessage . “Height : ” . $theight . “\n”;
$vmessage = $vmessage . “Width : ” . $twidth . “\n”;
$vmessage = $vmessage . “Shipping Address : ” . $tsaddress . “\n”;
$vmessage = $vmessage . “Date : ” . $tedate . “\n”;
$vmessage = $vmessage . “Shape Code : ” . $tshape . “\n”;
$vmessage = $vmessage . “Additional Info : ” . $tainfo . “\n”;
//$vmessage = $vmessage . “==================================================================\n”;
//$vmessage = $vmessage . “Link of Attachment File\n” . $path_of_uploaded_file;
//$vmessage = $vmessage . “\n“;
// To send HTML mail, the Content-type header must be set
$message = $vmessage;
// message lines should not exceed 70 characters (PHP rule), so wrap it
$message = wordwrap($message, 70);
// send mail
//mail($email_to,$email_subject,$message,$headers);
$attachments = array(WP_CONTENT_DIR . ‘/uploads/’ . $_FILES[“file”][“name”]);

$headers = ‘From: support@martialartkits.com’ . “\r\n”;
$headers .= “\r\nReply-To: ” . $temail;
wp_mail($email_to, $email_subject, $message, $headers, $attachments );
$headers .= “\r\nReply-To: ” . “sales@martialartkits.com”;
wp_mail($temail, $email_subject, $message, $headers, $attachments );
echo “Thank you for sending us feedback”;

[/php]