Con todos los archivos colgados,desde la web pulso en el botón examinar y cargo el documento.Se realiza la carga de 0 a 100%,y seguidamente me pone, error al enviar el mensaje.Dejo el código por si les sirve :
Código PHP:
<?php
header("Cache-Control: no-cache, must-revalidate");
header('Content-Type: text/html; charset=UTF-8');
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
$tmp_name = $_FILES['Filedata']['tmp_name'];
$type = $_FILES['Filedata']['type'];
$name = $_FILES['Filedata']['name'];
$size = $_FILES['Filedata']['size'];
if (file_exists($tmp_name)){
if(is_uploaded_file($tmp_name))
{
$file = fopen($tmp_name,'rb');
$data = fread($file,filesize($tmp_name));
fclose($file);
$data = chunk_split(base64_encode($data));
}
}
$remitente = "[email protected]";
$headers = "From:".$remitente."\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\"";
$subject = "Asunto del mensaje";
$message.= "INFORMACION:\n";
$message.= "\Mensaje de parte de : ".$_REQUEST[nombre]."\n";
$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";
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$type};\n" .
" name=\"{$name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
if (@mail($_REQUEST[destinatario], $subject, ($message), $headers)){
echo "1";
}
else {
echo "0";
}
?>