-3
A form with attachment that misses the shipment, on line 14. Help
<?php
$nome = $_POST['nome'];
$arquivo = $_FILES["arquivo"];
// Para quem vai ser enviado o email
$para = "eadamaral[@]gmail.com";
$boundary = "XYZ-".date("dmYis")."-ZYX";
$fp = fopen($arquivo["tmp_name"], "rb"); // abre o arquivo enviado
$anexo = fread($fp, filesize($arquivo["tmp_name"])); // calcula o tamanho
$anexo = base64_encode($anexo); // codifica o anexo em base 64
fclose($fp); // fecha o arquivo
// cabeçalho do email
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; ";
$headers .= "boundary="$boundary"\r\n";
$headers .= "$boundary\n";
// email
$mensagem = "--$boundary\n";
$mensagem .= "Content-Type: text/html; charset='utf-8'\n";
$mensagem .= "<strong>Nome: </strong> $nome \r\n";
$mensagem .= "--$boundary \n";
// anexo
$mensagem .= "Content-Type: ".$arquivo["type"]."; name="".$arquivo['name']."" \n";
$mensagem .= "Content-Transfer-Encoding: base64 \n";
$mensagem .= "Content-Disposition: attachment; filename="".$arquivo['name']."" \r\n";
$mensagem .= "$anexo \n";
$mensagem .= "--$boundary \n";
// enviar o email
mail($para, $assunto, $mensagem, $headers);
?>
Don’t post your code in image form. [en.so] has code support, just paste your code into the question editor, select it and press the shortcut
Ctrl+K
. You can also use the button{}
editor. Please log in to [Edit] and make the change.– Woss
I’m sorry Anderson, but I can’t make it, but I’m still gonna try again.
– Dias
So I recommend that you do before anything the [tour] by the site to learn at least the basics of how the site works. In it you will find guides on how to properly format your questions and answers.
– Woss