cheezel Posted December 6, 2012 Share Posted December 6, 2012 $ifok = true; if($_FILES['attachment']['size'] > 0 && $_FILES['attachment']['size'] <= 1048576){ $fileName = $_FILES['attachment']['name']; $tmpName = mysql_real_escape_string($_FILES['attachment']['tmp_name']); $fileSize = $_FILES['attachment']['size']; $fileType = $_FILES['attachment']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = mysql_real_escape_string($content); fclose($fp); $fileattach = "attach_filename = '$fileName', attach_size = '$fileSize', attachment = '$content', attach_type = '$fileType',"; } if($_FILES['attachment']['size'] > 1048576){ $size = 1; //$errormsg = 'File succeeded in 1MB limit'; $ifok = false; } if ($ifok){ //save to database mysql_query("insert into tblmessages set to_email = '" . $to . "', to_uc = '" . $toname . "', from_email= '" . $from . "', from_uc = '" . $xfr_code . "', subject = '" . $subject . "', msgbody = '" . $message . "', schoolid = '".$pschoolid."', attach_filename = '".$fileName."', attach_size = '".$fileSize."', attachment = '".$content."', attach_type = '".$fileType."', datesent = now()")or die(mysql_error()); } if($size == 1){ echo '<div class="error"> File exceeded in 1MB limit... </div>'; exit; } this is my code please do help me i'm freaking out ... Link to comment https://forums.phpfreaks.com/topic/271665-trouble-attaching-file-in-email/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 6, 2012 Share Posted December 6, 2012 You forgot to ask a question. What error or symptom are you getting or what problem do you need help with? Link to comment https://forums.phpfreaks.com/topic/271665-trouble-attaching-file-in-email/#findComment-1397835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.