提交后,pdf二进制文件保存到隐藏字段pdfStream如何使用php从隐藏字段中获取值并将其作为pdf文件发送到电子邮件
<input type="hidden" id="pdfStream" name="pdfStream" value="<?php echo $var; ?>" />
email.php
<?php
require('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "tls";
$mail->Port = 25;
$mail->Username = "@hotmail.com";
$mail->Password = "********";
$mail->Host = "smtp.live.com";
$mail->Mailer = "smtp";
$mail->AddAddress("@gmail.com");
$mail->Subject = $_POST["subject"];
$mail->WordWrap = 80;
$mail->MsgHTML($_POST["content"]);
$attachdata = $_GET['pdfStream'];
$mail->AddAttachment($attachdata,'ApplicationHistory','base64','application/pdf');
}
$mail->IsHTML(true);
if(!$mail->Send()) {
echo "<p class='error'>Problem in Sending Mail.</p>";
} else {
echo "<p class='success'>Contact Mail Sent.</p>";
}
?>
提交后我收到了pdf文件但没有内容(空白)
答案 0 :(得分:0)
你是否通过GET传递隐藏价值? 尝试使用$ _POST ['pdfStream']而不是$ _GET ['pdfStream']