在我的代码中,邮件功能可以正常工作,但是附件仅显示为名称,我希望附件可以作为下载类型。以下是代码:
这是我的表单代码:
所有邮件功能都正常工作,但我希望添加一个下载格式的附件。
<?php
include("db.php");
if(isset($_POST['submit']))
{
$cname=$_POST['cname'];
$file = $_FILES['file']['name'];
if($file != "")
{
$secondname=rand(0,10000000000);
$uploaddir = "img/careers/";
$upload_pic = $uploaddir.$secondname.$file;
copy($_FILES['file']['tmp_name'], $upload_pic);
chmod("$uploaddir",0777);
}
$email='nishanth.radical@gmail.com';
$subject ="Acknowledgement";
$from='developer@sixthstar.in';
$message ="Dear $cname,
Test Mail your resume is $upload_pic";
$headers = "From:".$from;
@mail($email,$subject,$message,$headers);
//echo "<div style='width: 350px; text-align: center; margin: 20% auto 0px; font-family: arial; font-size: 14px; border: 1px solid #ddd; padding: 20px
// 40px;'> Please wait while we update the record loading...</div>";
echo "<script type='text/javascript'>window.location = 'careers.php?msg=1'</script>";
exit();
}
?>
这是我的表单代码:
<form method="post" action="" id="accountx" method="post" enctype="multipart/form-data">
<div class="form-body pl-0">
<div class="spacer-b30">
<div class="tagline">
<span>Apply for a Job </span>
</div>
<!-- .tagline -->
</div>
<div class="section">
<label class="field prepend-icon">
<input type="text" name="cname" id="cname" class="gui-input" placeholder="Name...">
<span class="field-icon">
<i class="fa fa-user"></i>
</span>
</label>
</div>
<div class="section">
<label class="field prepend-icon">
<input type="file" name="file" id="file" class="gui-input" placeholder="Upload Resume">
<span class="field-icon">
<i class="fa fa-file"></i>
</span>
</label>
</div>
</form>
所有邮件功能都正常工作,但我希望添加一个下载格式的附件。