Send File Attachment from Form Using phpMailer and PHP

后端 未结 8 1033
予麋鹿
予麋鹿 2020-11-22 14:09

I have a form on example.com/contact-us.php that looks like this (simplified):

8条回答
  •  不知归路
    2020-11-22 15:00

    In my own case, i was using serialize() on the form, Hence the files were not being sent to php. If you are using jquery, use FormData(). For example

    
    
    
    
    

    Using jquery,

    $('#form').submit(function (e) {
    e.preventDefault();
    var formData = new FormData(this); // grab all form contents including files
    //you can then use formData and pass to ajax
    
    });
    

提交回复
热议问题