php - PHPMailer - AddAttachment not working
Get the solution ↓↓↓Solution:
Instead of using
$mail->AddAttachment($_POST['uploaded_file']); // WRONG
try this
if (isset($_FILES['uploaded_file']) &&
$_FILES['uploaded_file']['error'] == UPLOAD_ERR_OK) {
$mail->AddAttachment($_FILES['uploaded_file']['tmp_name'],
$_FILES['uploaded_file']['name']);
}
Uploaded files are stored in the temp folder. You should add the attachment from the filesystem, it is a mistake to use $_POST for this.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: target class [commandmakecommand] does not exist.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.