我有一个查询表格,其中包含用户的主要详细信息,如姓名,地址,电子邮件及其简历。我想将上传的简历发送到管理员的邮件ID并使用PHPMyadmin类。我的代码如下。
//Codes//
<?php
require 'PHPMailer/PHPMailerAutoload.php';
$allowedExts = array("docx", "pdf", "doc");
$temp = explode(".", $_FILES["upload"]["name"]);
$extension = end($temp);
if ((($_FILES["upload"]["type"] == "text/plain")
|| ($_FILES["upload"]["type"] == "application/doc")
|| ($_FILES["upload"]["type"] == "application/docx")
|| ($_FILES["upload"]["type"] == "application/pdf")
)) {
$file_to_attach= move_uploaded_file($_FILES["upload"]["tmp_name"], "cv/" . $_FILES["upload"]["name"]);
}
$bodytext='Name:'.$varName. 'Email:'.$varEmail.'Contact No:'.$varContactNumber;
$email = new PHPMailer();
$email->From = 'you@example.com';
$email->FromName = 'Your Name';
$email->Subject = 'Message Subject';
$email->Body = $bodytext;
$email->AddAddress( 'info@impulseinfo.com' );
// $file_to_attach = '/cv';
$email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' );
$email->Send();
header("Location:careers.php?s_msg=Your Message Send Succesfully.");
?>
But this is not working.I am not getting the uploaded file as attachments...Is this the way to do or should I opt for some other option.