I am green to PHP and trying to create outside PHP mailer for html form ,i found the script i need but I can't get it to upload more than one file ,since i do not know exactly where to place script request for file2-file10 as well as the exact line to place extension control and size limit ,SOS , any help would be aprishiated
the mailer script:
- <?php
-
if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ||
-
!strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
-
die("Bad referer");
-
$form_fields=array_keys($HTTP_POST_VARS);$temp="Sender's IP Address: ".$_SERVER['REMOTE_ADDR']."\n";while($field = array_pop($form_fields)){$temp.="$field: $HTTP_POST_VARS[$field]\n";}$to=$_POST['To'];$from=$_POST['Email'];$message=$temp;$fileatt=$_FILES['File']['tmp_name'];$fileatt_type=$_FILES['File']['type'];$fileatt_name=$_FILES['File']['name'];$headers="From: $from";if(is_uploaded_file($fileatt)){$file=fopen($fileatt,'rb');$data=fread($file,filesize($fileatt));fclose($file);$semi_rand=md5(time());$mime_boundary="==Multipart_Boundary_x{$semi_rand}x";$headers.="\nMIME-Version: 1.0\n"."Content-Type: multipart/mixed;\n"." boundary=\"{$mime_boundary}\"";$message="This is a multi-part message in MIME format.\n\n"."--{$mime_boundary}\n"."Content-Type: text/plain;charset=\"UTF-8\"\n"."Content-Transfer-Encoding: 7bit\n\n".$message."\n\n";$data=chunk_split(base64_encode($data));$message.="--{$mime_boundary}\n"."Content-Type: {$fileatt_type};\n"." name=\"{$fileatt_name}\"\n"."Content-Transfer-Encoding: base64\n\n".$data."\n\n"."--{$mime_boundary}--\n";}
-
-
$ok=@mail($to,"YOUR COMANY OR NAME Form-Mail Message",$message,$headers);
-
if(!$ok)header("location:domain goes here");
-
-
?>
[Please use CODE tags when posting source code. Thanks! --pbmods]