Hi I am having a problem can't seem to get my script working it was working fine with just one file before without the for and $x statements I have added can anyone see why it isn't working please ?
html
<form name="iapply3" method="post" action="ionline4.php">
<input type="hidden" name="MAX_FILE_SIZE" value="300000" />
<tr><td colspan="2" class="head">PHOTO </td></tr>
<tr><td colspan="2" class="name"><input type="file" name="fileatt[]" /></td></tr>
<tr><td colspan="2" class="head">PHOTO</td></tr>
<tr><td colspan="2" class="name"><input type="file" name="fileatt[]" /></td></tr>
php
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$to = 'info@apa.com';
$boundary = '==Multipart_Boundary_x' .md5(time()). 'x';
// headers
$headers .= "From: APA <noreply@apa.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed;\n boundary=\"$boundary\"\n\n";
// message
$message = "--{$boundary}\n";
$message .= "Content-Type: text/html; charset=iso-8859-1\n";
$message .= "Content-Transfer-Encoding: 7bit\n\n";
$message .= "<html>
<head>
<title>HTML message</title>
</head>
<body>
hello
if(is_uploaded_file($fileatt)){
for($x=0;$x<count($fileatt);$x++)
{
$fp = fopen($fileatt[$x], 'rb');
$data = fread($fp, filesize($fileatt[$x]));
fclose($fp);
$data = chunk_split(base64_encode($data));
$message .= "--{$boundary}\n";
$message .= "Content-Type: $fileatt_type[$x];\n name=\"$fileatt_name[$x]\"\n";
//$message .= "Content-Disposition: attachment;\n filename=\"$fileatt_name[$x]\"\n";
$message .= "Content-Transfer-Encoding: base64;\n\n$data\n\n";
$message .= "--{$boundary}--\n";
}
}
mail($to, $subject, $message, $headers);