darkfreaks Posted August 5, 2012 Share Posted August 5, 2012 so i am trying to do an upload attachment with mail says header already output on line 71 and file not uploaded. here is the code for file attachment as before i had no header error. // if not empty file upload field if (!empty($_FILES['file_upload']['name'])) { $file_name = $_FILES['file_upload']['name']; $tnp_name = $_FILES['file_upload']['tnp_name']; $file_type = $_FILES['file_upload']['type']; // get extension of file $base = basename($file_name); $ext = substr($base, strlen($base) - 4, strlen($base)); //allowed extensions $allowed_ext = array( 'jpeg', 'jpg', 'gif', 'png' ); //check if allowed extension if (in_array($ext, $allowed_ext)) { $file = $tmp_name; $content = chunk_split(base64_encode(file_get_contents($file))); $uid = md5(uniqid(time())); //declarinf mutlipart boundary type $headers .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n"; $headers .= "this is a message in multipart MIME format.\r\n"; //file file_upload $headers .= "--" . $uid . "\r\n"; $headers .= "Content-Type:" . $file_type . "; name=\"" . $file_name . "\"\r\n"; $headers .= "Content-Transfer-Encoding: Base64\r\n"; $headers .= "Content-Disposition: file_upload; filename=\"" . $file_name . "\"\r\n"; $headers .= $content . "\r\n\r\n"; } else { ///output header error somewhere above or below this line echo "File Type Not Allowed!"; } } else { echo "No File Uploaded!"; } not sure why i get no file uploaded much less output header on line 71 Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/ Share on other sites More sharing options...
darkfreaks Posted August 5, 2012 Author Share Posted August 5, 2012 was a small typo change $file= $tmp_name; to $file = $tnp_name; this changed nothing but i guess i caught something. Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367013 Share on other sites More sharing options...
Mahngiel Posted August 5, 2012 Share Posted August 5, 2012 It has been my understanding that checking a file's extension is less trust-worthy than checking the type. I have always checked by type for this reason and use this common array: $image_types = array('image/bmp','image/gif','image/jpeg', 'image/pjpeg','image/png', 'image/x-png'); I'm also confused on how you could get no file uploaded and a header error. your script only does one or the other Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367015 Share on other sites More sharing options...
jazzman1 Posted August 5, 2012 Share Posted August 5, 2012 You've got a error here, too: $tnp_name = $_FILES['file_upload']['tnp_name']; to be $tnp_name = $_FILES['file_upload']['tmp_name']; Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367017 Share on other sites More sharing options...
darkfreaks Posted August 5, 2012 Author Share Posted August 5, 2012 whole process page: <?php $name = "walpole-group.co.uk"; $to = "****"; //$to = "****"; /* subject */ $subject = "Walpole Group Male Application Form"; //html encoding unique id $headers .= "--" . $uid . "\r\n"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $headers .= $message . "\r\n\r\n"; $com12 = trim($_POST["radio1"]); $comDisplay12 = ($com12 == "Yes" ? " Yes " : " - "); $com13 = trim($_POST["radio2"]); $comDisplay13 = ($com13 == "Yes" ? " Yes " : " - "); $com14 = trim($_POST["radio3"]); $comDisplay14 = ($com14 == "Yes" ? " Yes " : " - "); $com16 = trim($_POST["piercings"]); $comDisplay16 = ($com16 == "Yes" ? " Yes " : " - "); $com17 = trim($_POST["tattoos"]); $comDisplay17 = (!empty($com17) ? "$com17" : " - "); $com18 = trim($_POST["checkbox"]); $comDisplay18 = (!empty($com18) ? "$com18" : " - "); $com19 = trim($_POST["checkbox2"]); $comDisplay19 = (!empty($com19) ? "$com19" : " - "); $com20 = trim($_POST["checkbox3"]); $comDisplay20 = (!empty($com20) ? "$com20" : " - "); $com21 = trim($_POST["checkbox4"]); $comDisplay21 = (!empty($com21) ? "$com21" : " - "); $com21a = trim($_POST["checkbox5"]); $comDisplay21a = (!empty($com21a) ? "$com21a" : " - "); $com22 = trim($_POST["checkbox6"]); $comDisplay22 = (!empty($com22) ? "$com22" : " - "); $com23 = trim($_POST["checkbox7"]); $comDisplay23 = (!empty($com23) ? "$com23" : " - "); // if not empty file upload field if (!empty($_FILES['file_upload']['name'])) { $file_name = $_FILES['file_upload']['name']; $tmp_name = $_FILES['file_upload']['tmp_name']; $file_type = $_FILES['file_upload']['type']; //allowed extensions $allowed_ext = array('image/bmp','image/gif','image/jpeg', 'image/pjpeg','image/png', 'image/x-png'); //check if allowed extension if (in_array($file_type, $allowed_ext)) { $file = $tmp_name; $content = chunk_split(base64_encode(file_get_contents($file))); $uid = md5(uniqid(time())); //declarinf mutlipart boundary type $headers .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n"; $headers .= "this is a message in multipart MIME format.\r\n"; //file file_upload $headers .= "--" . $uid . "\r\n"; $headers .= "Content-Type:" . $file_type . "; name=\"" . $file_name . "\"\r\n"; $headers .= "Content-Transfer-Encoding: Base64\r\n"; $headers .= "Content-Disposition: file_upload; filename=\"" . $file_name . "\"\r\n"; $headers .= $content . "\r\n\r\n"; } else { echo "File Type Not Allowed!"; } } else { echo "No File Uploaded!"; } //<hr align="center" width="100"" size="1" noshade color="#3C4B86"> $strBody = "<table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#000000 >"; $strBody = $strBody . "<tr><td valign=top><table width=710 cellpadding=0 cellspacing=0 border=0 bordercolor=#FFFFFF>"; $strBody = $strBody . "<tr><td colspan=2 ><font size=3 face=Verdana, Arial, Helvetica, sans-serif color=#FFFFFF><strong>Walpole Group Male Application Form</strong></font><br></td><td> </td></tr>"; $strBody = $strBody . "</tr><tr><td colspan=3><hr align=center width=100% size=1 noshade color=#3C4B86></td>"; //======================model contact info======================================= $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif><b>Model's Information</b></font></td><td> </td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Stage Name:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["stageName"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>First Name:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["firstName"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Surname:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["surName"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>N I No:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["niNo"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Date of birth:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["dob"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Age:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["age"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Star sign:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["star"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Address 1:</font></td>"; $strBody = $strBody . "<td width = 201 colspan=2><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["address1"]) . " </font></td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Address 2:</font></td>"; $strBody = $strBody . "<td width = 201 colspan=2><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["address2"]) . " </font></td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Address 3:</font></td>"; $strBody = $strBody . "<td width = 201 colspan=2><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["address3"]) . " </font></td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Town/City:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["town"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Postcode:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["postcode"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>States:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["states"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Home Telephone No:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["homeNo"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Mobile Telephone No:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["mobileNo"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Email Address:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["email"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Web Address:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["webAddress"]) . " </font></td><td> </td>"; //=====================model physical info======================================== $strBody = $strBody . "</tr><tr><td colspan=3><hr align=center width=100% size=1 noshade color=#3C4B86></td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif><b>Physical Descriptions</b></font></td><td> </td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Height:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["height"]) . "</font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Weight:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["weight"]) . "</font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Suit size:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["suitSize"]) . "</font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Shoe size:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["shoeSize"]) . "</font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Chest size:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["chestSize"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Waist Size:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["waistSize"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Leg Size:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["legSize"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Hair color:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["hairColor"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Length:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["length"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Eyes color:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["eyesColor"]) . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201 valign=top> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Complexion:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["complexion"]) . "</font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201 valign=top> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Ethnic origin:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["ethnicOrigin"]) . "</font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201 valign=top> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Other info:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Do you smoke:" . trim($_POST["radio1"]) . "<BR>Do you drink:" . trim($_POST["radio2"]) . "<BR>Do you drive:" . trim($_POST["radio3"]) . "</font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Piercings:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . $comDisplay16 . " </font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Tattoos:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . $comDisplay17 . " </font></td><td> </td>"; //======================model attributes============================================== $strBody = $strBody . "</tr><tr><td colspan=3><hr align=center width=100% size=1 noshade color=#3C4B86></td>"; $strBody = $strBody . "</tr><tr><td width=201 valign=top> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif><b>Model's attributes</b></font></td>"; $strBody = $strBody . "</tr><tr><td width=201 valign=top> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Work undertaken</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Fashion:" . $comDisplay18 . "</td><td><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Swimwear:" . $comDisplay19 . "</td></font></tr> "; $strBody = $strBody . "<tr><td> </td><td><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Nude:" . $comDisplay20 . "</font></td><td><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Boy / Girl Soft:" . $comDisplay21 . "</font></td></tr>"; $strBody = $strBody . "<tr><Td> </td><td><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Boy / Girl XXX:" . $comDisplay21a . "</font></td><td><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Stills:" . $comDisplay22 . "</font></td></tr>"; $strBody = $strBody . "<tr><Td> </td><td><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Video:" . $comDisplay23 . "</font></td><td> </td></tr>"; $strBody = $strBody . "</tr><tr><td width=201> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Previous experiences:</font></td>"; $strBody = $strBody . "<td colspan=2 width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["experience"]) . " </font></td>"; $strBody = $strBody . "</tr><tr><td width=201 valign=top> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Introduce By:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["introduceBy"]) . "</font></td><td> </td>"; $strBody = $strBody . "</tr><tr><td width=201 valign=top> <font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>Date:</font></td>"; $strBody = $strBody . "<td width = 201><font color=#CCCCCC size=2 face=Verdana, Arial, Helvetica, sans-serif>" . trim($_POST["dateTime"]) . "</font></td><td> </td>"; //======================model related info============================================ $strBody = $strBody . "</tr><tr><td colspan=3> </td></tr></table>"; //response.Write(strBody) $message = "" . $strBody; if ($Err != 0) { print "<script language=javascript>window.open('error.htm', 'winpop', 'scrollbars=no,width=470,height=150,left=250,top=20');window.history.go(-1);</script>"; //Response.Write "An error occurred: " & Err.Description } else { header("Location: " . "thankyou.php"); } //message now in multipart header mail($to, $subject, "", $headers); ?> Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367018 Share on other sites More sharing options...
jazzman1 Posted August 5, 2012 Share Posted August 5, 2012 Where is the line 71? Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367021 Share on other sites More sharing options...
darkfreaks Posted August 5, 2012 Author Share Posted August 5, 2012 } else { ///output header error somewhere above or below this line do i really need $content now that i am not checking for extensions just the mime type Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367022 Share on other sites More sharing options...
jazzman1 Posted August 5, 2012 Share Posted August 5, 2012 Delete this part of code ( on the top, line 9 or 10 ). $headers .= "--" . $uid . "\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367023 Share on other sites More sharing options...
darkfreaks Posted August 5, 2012 Author Share Posted August 5, 2012 do i need to delete both of them Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367024 Share on other sites More sharing options...
jazzman1 Posted August 5, 2012 Share Posted August 5, 2012 No, only this on the line 9 or 10 Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367027 Share on other sites More sharing options...
darkfreaks Posted August 5, 2012 Author Share Posted August 5, 2012 ok well that wasnt it then im still getting errors/ Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367028 Share on other sites More sharing options...
jazzman1 Posted August 5, 2012 Share Posted August 5, 2012 Ok, before php mail function, add this code and post out a result // add this echo '<pre>'.var_dump($headers).'</pre>'; exit; //before mail($to, $subject, "", $headers); Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367030 Share on other sites More sharing options...
darkfreaks Posted August 5, 2012 Author Share Posted August 5, 2012 string(103) "MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit " Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367031 Share on other sites More sharing options...
jazzman1 Posted August 5, 2012 Share Posted August 5, 2012 This content comes from lines 10, 11 and 12. Check your if and else statements b/s comes out nothing from there. Break down your code line by line and you will find the error. PS. You must re-structure your script Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367033 Share on other sites More sharing options...
darkfreaks Posted August 5, 2012 Author Share Posted August 5, 2012 so i crossed these lines out and i get NULL not sure why..... //$headers = "MIME-Version: 1.0\r\n"; //$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; //$headers .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; //$headers .= $message . "\r\n\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367035 Share on other sites More sharing options...
jazzman1 Posted August 5, 2012 Share Posted August 5, 2012 Before you send the script with php mail function, you have to gather all data to $header variable. Just re-structure your script, and I think everything will be fine Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367040 Share on other sites More sharing options...
darkfreaks Posted August 6, 2012 Author Share Posted August 6, 2012 how would you suggest i do that Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367064 Share on other sites More sharing options...
darkfreaks Posted August 6, 2012 Author Share Posted August 6, 2012 ok i think i got it down to where it pretty much doesn?t error any more. was due to having a process.php page. so i made it all one page. however it still says "file not uploaded" Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367073 Share on other sites More sharing options...
Mahngiel Posted August 6, 2012 Share Posted August 6, 2012 i like to catch my files by form input name... <input name="horse" /> if( $_FILES['horse'] ) {...} Quote Link to comment https://forums.phpfreaks.com/topic/266712-help-with-upload-attachment-mail-form/#findComment-1367079 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.