I'm using PHPMailer to send attachments via contact form.
Form front end:
<form action="mail.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="tipo" value="trabalhe-conosco">
<input class="input_100 require" type="text" name="nome" placeholder="Digite o seu nome">
<input class="input_49_left require email" type="text" name="email" placeholder="Digite o seu e-mail">
<input class="input_49_right require fone" type="text" name="telefone" placeholder="Telefone">
<select class="input_49_left require" name="cargo">
<option value="">Cargo</option>
<option value="Comercial">Comercial</option>
<option value="Administrativo">Administrativo</option>
</select>
<span class="btn btn-default btn-file">
<input type="file" name="curriculo" class="upload" value="">
</span>
<textarea class="input_100 require" name="mensagem" cols="30" rows="10" placeholder="Mensagem"></textarea>
<button type="submit" formmethod="POST" class="bt-enviar">Enviar</button>
mail.php (form action)
<?php
$GetPost = filter_input_array(INPUT_POST,FILTER_DEFAULT);
$Erro = true;
$Tipo = $GetPost['tipo'];
$Nome = $GetPost['nome'];
$Email = $GetPost['email'];
$Telefone = $GetPost['telefone'];
$Cargo = $GetPost['cargo'];
$Curriculo = $_FILES['curriculo'];
$Mensagem = $GetPost['mensagem'];
include_once 'PHPMailer/class.smtp.php';
include_once 'PHPMailer/class.phpmailer.php';
$Mailer = new PHPMailer;
$Mailer->CharSet = "utf8";
$Mailer->SMTPDebug = 3;
$Mailer->FromName = "Jogo Digital";
$Mailer->From = "[email protected]";
$Mailer->AddAddress("[email protected]");
$Mailer->IsHTML(true);
$Mailer->Subject = "Novo currículo \"Trabalhe Conosco\" - {$Nome}";
$Mailer->AddAttachment($Curriculo);
$Mailer->Body = "
Novo currículo enviado por {$Nome}<br />
Tipo: {$Tipo}<br /><br>
<b>Dados:</b><br /><br>
Email: {$Email}<br>
Telefone: {$Telefone}<br>
Cargo: {$Cargo}<br>
Mensagem: {$Mensagem}<br>
Curriculo: {$Curriculo['name']}
";
if($Mailer->Send()){
$Erro = false;
}
var_dump($Erro);
When sending the attachment does not arrive, and gives the following message: 2017-08-16 19:11:14 Could not access file: Array.
In the body of the email $ Curriculo ['name'] is returning the file name. What should I adapt in the code to work?