Olá.....
Por favor será que alguem consegue me ajudar...Estou precisando fazer um sistema simples de envio de arquivos para email, mas nao está dando muito certo.
...Esta acontecendo esses erros, será que é alguma coisa do servidor, meu site está hospedado no miarroba.com...
Warning: open_basedir restriction in effect. File is in wrong directory in /home/webcindario/vanesa/mail.php on line 22
Warning: fopen("/tmp/phpD96Q78", "r") - Operation not permitted in /home/webcindario/vanesa/mail.php on line 22
Warning: fread(): supplied argument is not a valid File-Handle resource in /home/webcindario/vanesa/mail.php on line 23
Warning: fclose(): supplied argument is not a valid File-Handle resource in /home/webcindario/vanesa/mail.php on line 25
O codigo é esse:
<?
$to = "vanesa <vanesa@..>";
$mailheaders = "vanesa <vanesa@..>\n";// $from\n";
//$mailheaders .= "Reply-To: $from\n";
//$mailheaders .= "Cc: $cc\n";
//$mailheaders .= "Bcc: Beto <gbtsouza@y...>\n";//$bcc\n";
//$mailheaders .= "X-Mailer: Script para enviar arquivo atachado\n";
$msg_body = stripslashes($body);
$subject = "Envio de arquivo";
if ($attach_size > 2000000){
echo "O Arquivo tem ". $attach_size . " bytes, sendo maior que o
permitido";
$erro = "1";
}
//if (($Enviar == "Enviar") && ($erro != 1)){
if (strlen($attach) != 0)
{
$file = fopen($attach, "r");
$contents = fread($file, $attach_size);
$encoded_attach = chunk_split(base64_encode($contents));
fclose($file);
$mailheaders .= "MIME-version: 1.0\n";
$mailheaders .= "Content-type: multipart/mixed; ";
$mailheaders .= "boundary=\"Message-Boundary\"\n";
$mailheaders .= "Content-transfer-encoding: 7BIT\n";
$mailheaders .= "X-attachments: $attach_name";
$body_top = "--Message-Boundary\n";
$body_top .= "Content-type: text/plain; charset=US-ASCII\n";
$body_top .= "Content-transfer-encoding: 7BIT\n";
$body_top .= "Content-description: Mail message body\n\n";
$msg_body = $body_top . $msg_body;
$msg_body .= "\n\n--Message-Boundary\n";
$msg_body .= "Content-type: $attach_type; name=\"$attach_name\"\n";
$msg_body .= "Content-Transfer-Encoding: BASE64\n";
$msg_body .= "Content-disposition: attachment;
filename=\"$attach_name\"\n\n";
$msg_body .= "$encoded_attach\n";
$msg_body .= "--Message-Boundary--\n";
mail($to, stripslashes($subject), $msg_body, $mailheaders);
}
//}
?>
<head>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
</head>
<body bgcolor="#ffffff">
<form action="<?=$PHP_SELF?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="300000">
<input type="file" name="attach"><br>
<input type="submit" name="Enviar" value="Enviar">
</body>