当我发送此文档时,我已经在我的邮件中发送word文档文件,它将生成未知格式,如asdfADFDF 0000sadfas15454454
我使用邮件功能发送邮件。
这是我的代码,请检查并告诉我。
function sendfile()
{
$id = $_REQUEST['id'];
$s=mysql_query("select * from file_doc where id='".$id."'");
$r= mysql_fetch_array($s);
$r['email']; // user email address
$docfile = "upload/".$r['cv']; // $r['cv'] is docfile
}
答案 0 :(得分:0)
尝试:
if (isset($_FILES['uploaded_file']) &&
$_FILES['uploaded_file']['error'] == UPLOAD_ERR_OK) {
$mail->AddAttachment($_FILES['uploaded_file']['tmp_name'],
$_FILES['uploaded_file']['name']);
}
基本示例也可以在这里找到。
AddAttachment的函数定义是:
public function AddAttachment($path,
$name = '',
$encoding = 'base64',
$type = 'application/octet-stream')