"; print_r($_FILES); print_r(error_reporting(E_ALL)); */ $mode = $_POST["mode"]; //print "This is the mode-->". $mode; $messagestring = ""; if ($mode == "send") { $result = validate(); //print "
$result"; //exit(); if ($result == "true") { $filetypes = array("text/plain","application/msword","application/pdf","application/vnd.ms-pki.stl","application/octet-stream"); //,"application/vnd.ms-pki.stl","application/octet-stream" //print_r($filetypes); //$filetypes = (["text/plain"],["application/msword"],["application/pdf"]); $contactname = $_POST["contactname"]; //text input $contactname = str_replace("\r\n", '',$contactname); $email = $_POST["email"]; //text input $email = str_replace("\r\n", '',$email); $companyname = $_POST["companyname"]; //textarea $companyname = str_replace("\r\n", '',$companyname); $phonenumber = $_POST["phonenumber"]; //textarea $phonenumber = str_replace("\r\n", '',$phonenumber); $instructions = $_POST["instructions"]; //textarea $instructions = str_replace("\r\n", '',$instructions); $process = $_POST["process"]; if ($process != "") { if ($process == "fdm") $process = "FDM Fused Deposition Modeling"; else if ($process == "fti") $process = "FTI Film Transfer Imaging"; else if ($process == "srp") $process = "SRP Subtractive Rapid Protyping"; } $model = $_POST["model"]; if ($model != "") { if ($model == "solid") $model = "Solid Normal"; else if ($model == "sparse") $model = "Sparse"; } $surface = $_POST["surface"]; if ($surface != "") { if ($surface == "unfinished") $surface = "Unfinished"; else if ($surface == "basic") $surface = "Basic Finish"; else if ($surface == "premium") $surface = "Premium Finish"; } $material = $_POST["material"]; if ($material != "") { if ($material == "White") $material = "White"; else if ($material == "Black") $material = "Black"; else if ($material == "Red") $material = "Red"; else if ($material == "Blue") $material = "Blue"; } $message = "\n Contact Name: $contactname \n Email: $email \n Company Name: $companyname \n Phone Number: $phonenumber \n RP Process: $process \n Model Interior: $model \n Surface Finish: $surface \n Material Color: $material \n Special Instructions: $instructions \n"; $subject = "Coho Design Quote Request"; $to = "khuber@cohodesignsllc.com"; $from = "khuber@cohodesignsllc.com"; // Obtain file upload vars $headers = "From: $from"; // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message $message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $bad_docs = ""; $fileatt_size = ""; $total_size = 0; for ($count = 1; $count < 7; $count++) { $myFile{$count} = $_FILES['file'.$count]['tmp_name']; if (is_uploaded_file($myFile{$count})) { $fileatt = $_FILES['file'.$count]['tmp_name']; $fileatt_type = $_FILES['file'.$count]['type']; $fileatt_name = $_FILES['file'.$count]['name']; $fileatt_size = $_FILES['file'.$count]['size']; $total_size = $total_size + $fileatt_size; //print "
This is the total size--> ".$total_size; //print "
MADE IT HERE"; // Read the file to be attached ('rb' = read binary) if (in_array($fileatt_type, $filetypes)) { if ($_FILES['file'.$count]['error'] != "1") { $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); //print "MADE IT HERE
"; // Base64 encode the file data $data = chunk_split(base64_encode($data)); // Add file attachment to the message $files .= "--{$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"; } else { $bad_docs .= $fileatt_name . " is too large. Please keep each file size below 2M.
"; } } else { $bad_docs .= $fileatt_name . " is not an accepted file type.
"; } } } $endmessage .= "--{$mime_boundary}--\n"; if ($files != "") { $message .= $files . $endmessage; //print "This is the entire message --> ". $message ."
"; $ok = mail($to, $subject, $message, $headers); //print "
This is the mail message--> [".$message."]"; if ($ok == "") { if ($bad_docs == "") { $messagestring = "Thank you for sending your quote request!"; $_POST["contactname"] = ""; $_POST["companyname"] = ""; $_POST["email"] = ""; $_POST["phonenumber"] = ""; $_POST["instructions"] = ""; } else { $messagestring = "Thank you for sending your quote request! But the files listed below were not sent.
". $bad_docs; } } else { $messagestring = "Mail could not be sent. Sorry!
". $bad_docs; mail("luke.helm@gmail.com", "Coho Design Quote Page Error", $message, $headers); } } else { $messagestring = "Nothing was sent because of these files.
". $bad_docs; } } else { $messagestring = $result; } } ?> Coho Design Home Page
CALL 386-931-4060
FAX 386-986-1569
info@cohodesignsllc.com
home_1 request_1 services_1
portfolio_1 downloads_1 our_promise_1
$messagestring"; ?>
*Contact Name: *Email Address:
*Company Name: *Phone Number:
FDM Fused Deposition Modeling FTI Film Transfer Imaging SRP Subtractive Rapid Protyping
Solid Normal Sparse
Unfinished Basic Finish Premium Finish
White Black Red Blue

Coho Designs accepts Visa, Mastercard or Purchase Order.
For credit card orders, please do not upload this information at this time, as we will request it via telephone or fax.
Upon submittal, we will process your request and provide a quote the same day.
RP Process Model Interior Help Me Surface Finish Help Me Attach Files Melp Me "; } if ($_POST["email"] == "") { $messagestring .= "Please enter your email.
"; } if ($_POST["companyname"] == "") { $messagestring .= "Please enter your company name.
"; } if ($_POST["phonenumber"] == "") { $messagestring .= "Please enter your phone number.
"; } if ($_POST["process"] == "") { $messagestring .= "Please select a RP Process.
"; } if ($_FILES["file1"]["name"] == "" && $_FILES["file2"]["name"] == "" && $_FILES["file3"]["name"] == "" && $_FILES["file4"]["name"] == "" && $_FILES["file5"]["name"] == "" && $_FILES["file6"]["name"] == "") { $messagestring .= "Please upload at least one file.
"; } if ($_POST["instructions"] == "") { $messagestring .= "Please enter some instructions.
"; } if ($messagestring == "") return true; else return $messagestring; } ?>