Ваши ссылки на массив отключены.Когда у вас есть
<input type=file name=csv_file[]>
Вам понадобится ссылка
$_FILES['csv_file'][0]
Чтобы получить первый файл
Так что
for($i=0; $i < count($_FILES['csv_file']); $i++){
$ftype[]=$_FILES['csv_file'][$i]['type'];
$fname[]=$_FILES['csv_file'][$i]['name'];
}
Будет работатьлучше для вас ....
Хорошо, согласно вашему комментарию, вы, по крайней мере, получаете данные.
Вот что работает для меня для моего скрипта form2mail, который обрабатывает вложения (илине ...)
// build headers
$separator=md5(time());
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: $from_name <$from_address>\r\n";
$headers .= "Date: " . date("Ymd H:i:s") . "\r\n";
$headers .= "Reply-To: $from_name <$from_address>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: ".$_SERVER['PHP_SELF']. "?id=". $_SERVER['UNIQUE_ID']. "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= "This is a MIME encoded message.\r\n";
// headers complete
// build message body
// text message as normal for form2mail
$messageBody="--".$separator."\r\n";
$messageBody.="Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$messageBody.="Content-Transfer-Encoding: 8bit\r\n";
$messageBody.="\r\n".$message_body."\r\n\r\n";
// add attachments
for($i=0;$i<count($attachments);$i++){
$attachcontent=chunk_split(base64_encode(file_get_contents($attachments[$i]['tmp_name'])));
$messageBody.="--".$separator."\r\n";
$messageBody.="Content-Type: application/octet-stream; name=\"".$attachments[$i]['name']."\"\r\n";
$messageBody.="Content-Transfer-Encoding: base64\r\n";
$messageBody.="Content-Disposition: attachment; filename=\"".$attachments[$i]['name']."\"\r\n";
$messageBody.="\r\n".$attachcontent."\r\n";
}
$messageBody.="--" . $separator . "--";
mail($to_address, $subject, $messageBody, $headers);