
Codigo PHP:
<?
if ($action != "upload")
{
print '
<FORM METHOD="post" ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<TABLE BORDER="1">
<TR>
<TD>De: </TD>
<TD><input type="text" name="from" size=40><BR></TD>
</TR>
<TR>
<TD>Para: </TD>
<TD><input type="text" name="to" size=40><BR></TD>
</TR
<TR>
<TD>Assunto: </TD>
<TD><input type="text" name="subject" size=40><BR></TD>
</TR
<TR>
<TD>Cc: </TD>
<TD><input type="text" name="cc" size=40><BR></TD>
</TR
<TR>
<TD>Bcc: </TD>
<TD><input type="text" name="bcc" size=40><BR></TD>
</TR
<TR>
<TD>Mensagem: </TD>
<TD><TEXTAREA NAME="body" ROWS="10" COLS="50"></TEXTAREA></TD>
</TR>
<TR>
<TD>Anexo: </TD>
<TD><INPUT TYPE="file" NAME="anexo"></TD>
</TR>
<TR>
<TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Enviar"></TD>
</TR>
</TABLE>
</FORM>
';
}
if ($action == "upload")
{
$mime_list = array("html"=>"text/html","htm"=>"text/html", "txt"=>"text/plain", "rtf"=>"text/enriched","csv"=>"text/tab-separated-values","css"=>"text/css","gif"=>"image/gif");
$ABORT = FALSE;
$boundary = "XYZ-" . date(dmyhms) . "-ZYX";
$message = "--$boundary\n";
$message .= "Content-Transfer-Encoding: 8bits\n";
$message .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\n\n";
$message .= $body;
$message .= "\n";
$attachments[1] = $anexo;
foreach ($attachments as $key => $full_path) {
if ($full_path !='') {
if (file_exists($full_path)){
if ($fp = fopen($full_path,"rb")) {
$filename = array_pop(explode(chr(92),$full_path));
$contents = fread($fp,filesize($full_path));
$encoded = base64_encode($contents);
$encoded_split = chunk_split($encoded);
fclose($fp);
$message .= "--$boundary\n";
$message .= "Content-Type: $anexo_type\n";
$message .= "Content-Disposition: attachment; filename=\"$anexo_name\" \n";
$message .= "Content-Transfer-Encoding: base64\n\n";
$message .= "$encoded_split\n";
}
else {
echo "Impossível abrir o arquivo$key: $filename";
$ABORT = TRUE;
}
}
else {
echo "O arquivo$key não existe: $filename";
$ABORT = TRUE;
}
}
}
$message .= "--$boundary--\r\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "From: <$from>\r\n";
$headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";
$mensagem=mail("ftajr@hotmail.com", $subject, $message, $headers);
if ($mensagem) {
print "Mensagem enviada!";
} else {
print "O envio da mensagem falhou!";
}
}
?>
fim
link postado em PHP 5:
www.dkvtapetes.com.br/anexo.php
como voces vêm o erro acontece na lina de upload não sei o que fazer já to até cansado de tanto procurar. testei em outro serve com php 4 funciona perfeito só nesse que o site que ta registrado q usa o 5 que ta dando bronca lembrando q ja mandei ativar o suporte a php e não esta em saft mode.