Ir para conteúdo
Fórum Script Brasil
  • 0

Upload


J Nilson

Pergunta

Estou tentando colocar um formulário no meu site e está funcionando, agora quando tento anexar um arquivo, tipo imagem só vai o endereço da imagem, o que está errado nestes scripts?

Se alguém puder me ajudar eu agradeço.

<html>
<head>
<title>Formulário de Contato</title>
<style type="text/css">
#assina table {
 background-color: #FFFFFF;
 color: #000000;
 width: 300px;
 border: 1px solid #D7E5F2;
 border-collapse: collapse;}

#assina td {
 border: 1px solid #D2D1D0;
 padding-left: 5px;}

.etiqueta {
 font: 10px Verdana, Geneva, Arial, Helvetica, sans-serif;
 color: #2E4A52;
 background-color: transparent;
 width: 100px;}

.campo {
 background-color: #FFFFFF;
 color: #000000;
 text-align: LEFT;
 margin-right: 0px;
 padding-right: 0px;}

.etiquetapequena {
 font: 10px Verdana, Geneva, Arial, Helvetica, sans-serif;
 background-color: transparent;
 color: #2E4A52;
 width: 85px;}

.campopequeno {
 background-color: #FFFFFF;
 color: #000000;
 text-align: LEFT;}

.campo input {
 width: 180px;
 font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif;
 background-color: #FEFEFE;
 color: #102132;
 border: 1px solid #7F9DB9;
 margin-right: 5px;
}

.campopequeno input {
 width: 89px;
 font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif;
 background-color: #FEFEFE;
 color: #102132;
 border: 1px solid #7F9DB9;
 margin-right: 5px;
}

.campopequeno select {
 font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif;
 background-color: #FEFEFE;
 color: #102132;
 border: 1px solid #284279;
}

.botao {
 font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif;
 background-color: #F75100;
 color: #FFFFFF;
 margin-left: 0px;
 margin-top: 3px;
 margin-bottom: 2px;
}

</style>
</head>
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<form name="assina" id="assina" method="post" action="contato_process.php">
 <table align="center" width="300" border="0" cellpadding="0" cellspacing="0">

      <tr>
     <td colspan="2" class="etiqueta"><label for="pw_nome1">Nome/Empresa:</label></td>
     <td colspan="2" class="campo"><input type="text" name="pw_nome" id="pw_nome"></td>
   </tr>

   <tr>
     <td class="etiquetapequena"><label for="pw_email">Email:</label></td>
     <td class="campopequeno" align="center"> <input type="text" name="pw_email" id="pw_email" ></td>
      <td class="etiquetapequena"><label for="pw_telefone1">Tel: (DDD)</label></td>
     <td class="campopequeno"> <input type="text" name="pw_tel_ddd" id="pw_tel_ddd" ></td>
   </tr>
   <tr>
     <td class="etiquetapequena"><label for="pw_cidade">Cidade:</label></td>
     <td class="campopequeno"> <input type="text" name="pw_cidade" id="pw_cidade" ></td>
     <td class="etiquetapequena"><label for="pw_estado">Estado:</label></td>
     <td class="campopequeno" align="center"> <input type="text" name="pw_estado" id="pw_estado" ></td>
   </tr>
   <tr>
     <td colspan="1" class="etiqueta"><label for="attachment">Arquivo:</label></td>
     <td colspan="3" class="campo"> <input type="file" name="attachment" id="attachment" ></td>
   </tr>
   <tr>
      <td class="etiquetapequena">Anúncio:</td>
      <td colspan="3" class="campopequeno">
	  <textarea name="anuncio" id="anuncio" cols="32" rows="2"></textarea></td>
    </tr>
   <tr>
     <td colspan="4" height="5">
     <img src="imagens/spacer.gif" height="1"></td>
   </tr>

   <tr>
     <td colspan="4"><input type="submit" name="Enviar" value="Enviar"  class="botao"></td>
   </tr>

 </table>
</form>

</body>
</html>
<?

    $para    = "atendimento@n5design.com.br";
    $assunto = "Solicitação de Anúncio on-line";

    $msg = "";
    $msg .= "\n";
    $msg .= "\n <hr color=#29518E size=1><font face=verdana style=font-size:11px><strong>» FOMULÁRIO DE CONTATO</strong>";
    $msg .= "\n <hr color=#29518E size=2> ".htmlspecialchars($_POST[''], ENT_QUOTES);
    $msg .= "\n <strong>Nome:</strong> ".htmlspecialchars($_POST['pw_nome'], ENT_QUOTES);
    $msg .= "\n <strong>Email:</strong> ".htmlspecialchars($_POST['pw_email'], ENT_QUOTES);
    $msg .= "\n <strong>Telefone:</strong> ".htmlspecialchars($_POST['pw_tel_ddd'], ENT_QUOTES);
    $msg .= "\n <strong>Cidade:</strong> ".htmlspecialchars($_POST['pw_cidade'], ENT_QUOTES);
    $msg .= "\n <strong>Estado:</strong> ".htmlspecialchars($_POST['pw_estado'], ENT_QUOTES);
    $msg .= "\n <strong>Arquivos:</strong> ".htmlspecialchars($_POST['attachment'], ENT_QUOTES);
    
    $msg .= "\n";
    $msg .= "\n<hr color=#29518E size=1><font face=verdana style=font-size:11px><strong>Texto do Anúncio:</strong></font>";
    $msg .= "\n <hr color=#29518E size=1> \n ".htmlspecialchars($_POST['anuncio'], ENT_QUOTES);
    $msg .= "\n \n ";
    $msg .= "\n \n ";    
    
    $email = 'Negócio e Vendas - Pedido de Anúncio';
    $headers = "From: $email\n";
    $headers .= "Reply-To: $email\n";
    $headers .= "Cc: \n";
    $headers .= "Bcc: \n ";
    $headers .= "X-Mailer: .\n";
    $headers .= "MIME-version: 1.0\n";
    $headers .= "Content-type: multipart/mixed; ";
    $headers .= "boundary=\"Message-Boundary\"\n";
    $headers .= "Content-transfer-encoding: 7BIT\n";

    $tmp_msg = "--Message-Boundary\n";
    $tmp_msg .= "Content-type: text/html; charset=US-ASCII\n";
    $tmp_msg .= "Content-transfer-encoding: 7BIT\n";
    $tmp_msg .= "Content-description: Mail message body\n\n";



/*
    if (($fp = fopen($_FILES['anexo']['tmp_name'],"rb"))) {
        $conteudo = fread($fp,filesize($_FILES['anexo']['tmp_name'])); 
        $arquivo_em_base64 = chunk_split(base64_encode($conteudo));
        fclose($fp);

        $tmp_msg2 = "\n\n--Message-Boundary\n";
        $tmp_msg2 .= "Content-type: $anexo_type; name=\"$anexo_name\"\n";
        $tmp_msg2 .= "Content-Transfer-Encoding: BASE64\n";
        $tmp_msg2 .= "Content-disposition: attachment; filename=\"$anexo_name\"\n\n";
        $tmp_msg2 .= "$arquivo_em_base64\n";
        $tmp_msg2 .= "--Message-Boundary--\n"; 
        
        $headers .= "X-attachments: $anexo_name";

    }
*/


    $html_inicio = "<html><body>";
    $html_fim = "</body></html>";

//    $mensagem1 = $tmp_msg.$html_inicio.nl2br($msg).$html_fim.$tmp_msg2;
    $mensagem1 = $tmp_msg.$html_inicio.nl2br($msg).$html_fim;

//echo $mensagem1;

    mail($para, $assunto, $mensagem1, $headers);
    header("location: sucesso.html");

?>

meu email é: n5design@hotmail.com

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652k
×
×
  • Criar Novo...