Form

getExtension(); return pathinfo($filename, PATHINFO_EXTENSION); } } function image_upload($file){ if ( $file["error"] == 0 ){ $type_accepted = array("jpeg", "jpg", "gif", "png"); if ( in_array( get_file_type($file["name"]), $type_accepted ) ){ //if ( in_array( $file['type'], $type_accepted ) ){ $filename = md5(microtime(true)).".".get_file_type($file["name"]); //$filename = md5(microtime(true)).$ext; $destination = dirname(__FILE__)."/attachments/".$filename; if ( move_uploaded_file($file['tmp_name'], $destination ) ) { return $filename; } //else return "Sorry, there was an error uploading your file."; else return ""; } else { //return 'Only Allowed "jpeg", "jpg", "gif", "png"'; return ""; } } } if ( $_POST ){ $data = '

Here is the contact form

Category = '.$_POST["category"].'
Business Name = '.$_POST["bus_name"].'
Description = '.str_replace(PHP_EOL,"
",$_POST["desc"]).'
Address = '.$_POST["address"].'
Phone = '.$_POST["phone"].'
Cell = '.$_POST["cell"].'
Email = '.$_POST["email"].'
Website = '.$_POST["website"].'
Licenses/Certifications = '.$_POST["lic_cert"].'
'; $to = "mrosmantahir@gmail.com"; $subject = "Contact Form Received"; $from = "admin@zitecode.com"; $headers = "From: $from\r\n"; $headers .= "MIME-Version: 1.0\r\n" ."Content-Type: multipart/mixed; boundary=\"1a2a3a\""; $message .= "If you can see this MIME than your client doesn't accept MIME types!\r\n" ."--1a2a3a\r\n"; $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n" ."Content-Transfer-Encoding: 7bit\r\n\r\n" .$data ."\r\n" ."--1a2a3a\r\n"; $uploaded_filename = image_upload($_FILES['img1']); if ( $uploaded_filename != "" ) { $attachment = "attachments/".$uploaded_filename; $file = file_get_contents($attachment); $message .= "Content-Type: image/jpg; name=\" ".$attachment." \"\r\n" ."Content-Transfer-Encoding: base64\r\n" ."Content-disposition: attachment; file=\" ".$attachment." \"\r\n" ."\r\n" .chunk_split(base64_encode($file)) ."--1a2a3a--"; } mail($to,$subject,$message,$headers); echo "Contact Form Submitted"; } ?>
Category =
Business Name =
Description =
Address =
Phone =
Cell =
Email =
Website =
Licenses/Certifications =
Image 1 =