phpMailer attachment

前端 未结 7 1920
时光取名叫无心
时光取名叫无心 2020-12-06 08:55

I\'m using this to attach files to an mail after uploading them to my server:

for ($i = 0; $i <= 2; $i++)
{
    $mail->AddAttachment($locatie.$_FILES[\         


        
相关标签:
7条回答
  • 2020-12-06 09:31

    You need to check if that file was actually uploaded/exists before adding the attachment. Something like

    for ($i = 0; $i <= 2; $i++)
    {
        if (file_exists($locatie.$_FILES['uploaded'.$i]['tmp_name'])) {
            $mail->AddAttachment($locatie.$_FILES['uploaded'.$i]['tmp_name'], $_FILES['uploaded'.$i]['name']);
        }
    }
    
    0 讨论(0)
提交回复
热议问题