I want to mail two attachments and choice file from two different input tags. I fine a code that send only one file. my code is
<?php
if(isset($_POST) && !empty($_POST))
{
if(!empty($_FILES['attachment']['name']))
{
$file_name = $_FILES['attachment']['name'];
$temp_name = $_FILES['attachment']['tmp_name'];
$file_type = $_FILES['attachment']['type'];
$base = basename($file_name);
$extension = substr($base, strlen($base)-4, strlen($base));
$allow_extension = array(".jpg",".pdf",".png");
if(in_array($extension,$allow_extension))
{
$form = $_POST['email'];
$to = "hassanh80@gmail.com";
$subject = "Subject Here";
$message = "Message Here";
$file = $temp_name;
$content = chunk_split(base64_encode(file_get_contents($file)));
$uid = md5(uniqid(time()));
$header = "From: ". $form . "
";
$header .= "Replay-To: ". $to . "
";
$header .= "MIME-Version: 1.0
";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"
";
$header .= "This is multi-part message in MIME format.
";
$header .= "--".$uid."
";
$header .= "Content-type:text/plain; charset=iso-8859-1
";
$header .= "Content-Transfer-Encoding: 7bit
";
$header .= $message."
";
$header .= "--".$uid."
";
$header .= "Content-Type: ".$file_type."; name=\"".$file_name."\"
";
$header .= "Content-Transfer-Encoding: base64
";
$header .= "Content-Disposition: attachment; filename=\"".$file_name."\"
";
$header .= $content."
";
if(mail($to,$subject, "", $header))
{
echo "Successfull";
}
else
{
echo "Fail";
}
}
else
{
echo "File Type Not Allow...!";
}
}
else
{
echo "No File Posted...!";
}
}
?>
<form method="post" action="mail1.php" enctype="multipart/form-data">
<input type="email" name="email" />
<br />
<input type="file" name="attachment" />
<br />
<input type="submit" value="Send">
</form>
Now I want to put one more input file tag. I tried many time but not worked. kindly help me out.