【发布时间】:2017-09-06 09:34:02
【问题描述】:
上传文件时不要在 php.ini 中发送到电子邮件。这是我的代码。
<form method="post" action="">
Name : <input type="text" name="name"><br>
Email : <input type="text" name="email"><br>
Upload File : <input type="file" name="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
<?php
if(isset($_POST['submit'])){
$name=$_POST['name'];
$email=$_POST['email'];
$image=$_FILES['file']['name'];
$img=$_FILES['file']['tmp_name'];
$recipient = "test1@gmail.com";
// Mail subject
$subject = "contact by $name";
// Mail content
$email_content = " contact from $name
Name : $name
Email : $email
File : $image
";
// Mail headers
$email_headers = "From:test1@gmail.com";
// Main messages
if (mail($recipient, $subject, $email_content, $email_headers))
{
echo "success";
}
else
{
}
?>
姓名和电子邮件已发送到电子邮件,但上传的文件未显示在我的电子邮件中。在仅显示上传文件名的电子邮件中。如何解决这个问题。
【问题讨论】: