0

After searching Stack Overflow and the net for this answer, I am requesting assistance. I currently have a form that allows allows a user to upload a file. It is my desire that once this file is uploaded, to then use it as an embedded image in an HTML email by phpmailer. I can upload the file, but when I pass the info to the next page, the code is not picking up the file.

The form uses this label for the attachment (put spaces so code shows up):

<p>
  <label><span>Attachment</span>
    <input type="file" name="file_attach[]"/>
  </label>
</p>

When the form is submitted, the action calls email4.php (which then sends the mail to a local postfix server. In this code, I reference the file as a variable:

$mypromo = $_FILES['file_attach'];

Then I use that variable as the embedded image:

$mail->AddEmbeddedImage($mypromo, "my-attach", "tourney");

Once I send the email, the email comes thru, but no image. Previously, the image shows up if I reference a file on the file system with a path/filename. Is there a way I can use an uploaded file as an embedded image in phpmailer?

Alexander van Oostenrijk
  • 4,644
  • 3
  • 23
  • 37
  • 1
    Possible duplicate of [Send email with PHPMailer - embed image in body](http://stackoverflow.com/questions/3708153/send-email-with-phpmailer-embed-image-in-body) – Brian Glaz Sep 16 '16 at 18:45
  • 1
    RTFM: [handling post uploads](http://php.net/manual/en/features.file-upload.post-method.php). `$_FILES['file_attach']` is **NOT** your uploaded file. it's metadata ABOUT your (maybe) uploaded file. – Marc B Sep 16 '16 at 18:51
  • Marc...no need to rude. I just started php like 5 days ago. – Chris LaBrado Sep 16 '16 at 19:57
  • and for the record, I got it working just fine. – Chris LaBrado Sep 16 '16 at 23:39

0 Answers0