"; print_r($_FILES); echo "";die; $filePath = 'upload/'.$_FILES['file']['name']; $fileName = $_FILES['file']['name']; $fileType = 'image/jpeg'; move_uploaded_file($_FILES['file']['tmp_name'],'upload/'.$filePath); $boundary = '-----=' . md5( uniqid ( rand() ) ); $message = "Content-Transfer-Encoding: base64\n"; $message .= "Content-Disposition: attachment; filename=\"$theFile\"\n\n"; $path = $filePath; $fp = fopen($path, 'r'); do //we loop until there is no data left { $data = fread($fp, 8192); if (strlen($data) == 0) break; $content .= $data; } while (true); $content_encode = chunk_split(base64_encode($content)); $message .= $content_encode . "\n"; $message .= "--" . $boundary . "\n"; $headers = "From: ".$_POST['businessname']."\r\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\""; $subject = "Ask For A Quote: Form Submission"; $message .= "Ask For A Quote: Form Submission : Business Name: ".$_POST['businessname']." Web Site: ".$_POST['Website']." Your First Name: ".$_POST['yourfirstname']." Your Last Name: ".$_POST['yourlastname']." Email address: ".$_POST['emailaddress']." Phone: ".$_POST['Phone']." Skype address: ".$_POST['skypeaddress']." Type of Business: ".$_POST['typeofbusiness']." Project Name: ".$_POST['projectname']." Project Start Day: ".$_POST['projectstartdaya']." Project Description: ".$_POST['projectdescription']." if you have an RFP please Upload ".$fileName." Best time to reach you?: ".$_POST['hour']." ".$_POST['minute']." ".$_POST['ampm']." Best way to reach you? ".$_POST['bestwaytoreachyou']." "; $message1 = stripcslashes($message); mail("info@wyswygllc.com,aneeshj@opendooroutsourcing.com", $subject, $message1, $headers); header("Location:ask_for_a_quote.php"); $cr = "\n"; $data = $_POST['businessname'] . ',' . $_POST['Website'] . ',' . $_POST['yourfirstname'] . ',' . $_POST['yourlastname'] . ',' . $_POST['emailaddress'] . ',' . $_POST['Phone'] .$_POST['skypeaddress'] . ',' . $_POST['typeofbusiness'] . ',' . $_POST['projectname'] . ',' . $_POST['projectstartdaya'] . ',' . $_POST['projectdescription'] . ',' . $_POST['hour'] . ',' . $_POST['minute'] . ',' . $_POST['ampm'] . ',' . $_POST['bestwaytoreachyou'] . $cr; $filename = "csvdata.csv"; $fp = fopen($filename,"a"); // $fp is now the file pointer to file $filename if($fp){ fwrite($fp,$data); // Write information to the file fclose($fp); // Close the file echo "csvfile=saved"; } else { echo "csvfile=notsaved"; } ?>