如何将文件发送给使用联系表的用户?

时间:2019-03-11 03:24:03

标签: php ajax

如何将文件返回到我网站上的用户联系表php + ajax?

mail($to,$email_subject,$email_body,$headers);
return readfile(polychor_file.pdf);    

2 个答案:

答案 0 :(得分:0)

您是否询问发送带有附件的电子邮件?如果是,那么这里是有关如何“发送带有附件的电子邮件”的来源:https://www.codexworld.com/send-email-with-attachment-php/

答案 1 :(得分:0)

如果要提交退货:

    $attachment_location = "usaflag.gif";

    if (file_exists($attachment_location)) {

        header("Content-Description: File Transfer");
        header("Cache-Control: public"); 
        header("Content-Type: application/octet-stream'");
        header("Content-Transfer-Encoding: Binary");
        header("Content-Length:".filesize($attachment_location));
        header("Content-Disposition: attachment; filename=usaflag.gif");
        readfile($attachment_location);
        die();        
    } else {
        die("Error: File not found.");
    }