0

我已经为一个网站创建了一个职业表格,我希望人们上传简历并在我的邮件中收到它,我做了一些事情,我从文本框和选择框中接收提交的数据,但我无法接收附件,请帮助我接收邮件中的附件,这是我的表单和 php 代码:

<form method="post" action="careermail.php">
            <table border="0">
            <tr><td class="text">Name</td></tr>
             <tr><td>
            <input class="txtbox" type="text" name="Name" placeholder="Your Name" required="required" /></td></tr>
             <tr><td class="text">Email</td></tr>
            <tr><td><input class="txtbox" type="email" name="Email" placeholder="Your Email" required="required" /></td></tr>
            <tr><td class="text">Role</td></tr>
           <tr><td><select class="slbox" name="Role">
  <option value="development">Development</option>
  <option value="designing">Designing</option>
  <option value="testing">Testing</option>
  <option value="marketing">Marketing</option>
</select></td></tr>
<tr><td class="text">Upload your resume</td></tr>
<tr><td><input class="file" type="file" name="file" size="40"><br /></td></tr>     
<tr><td style="text-align:right;"> <input class="submit" type="Submit" value="Submit" placeholder="Your Email" /></td></tr>
            </table>
            </form>




<script type="text/javascript"> 
    window.alert("Thank you! We will get back to you shortly."); 
window.location.replace("career.html");
  </script> 



<?php

// VALUES FROM THE FORM

$name      = $_REQUEST['Name'];
$email     = $_REQUEST['Email'];
$role = $_REQUEST['Role'];
$File = $_REQUEST['File'];



$fields = array();
$fields{"Name"} = "Name";
$fields{"Email"} = "Email";
$fields{"Role"} = "Role";
$fields{"File"} = "Message";

// CREATE THE EMAIL

$headers    = "Content-Type: text/plain; charset=iso-8859-1\n";

$headers    = "From: $name $email <$email>\n";

$recipient  = "info@appsysinfotech.com";

$subject    = "Career Form";

$message    = "A message has been sent from: \n\n"; foreach($fields as $a => $b){ $message .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

// SEND THE EMAIL TO YOU

mail($recipient, $subject, $message, $headers);

?>
4

1 回答 1

0

请通过以下链接。它将向您解释如何使用 php- 在邮件中附加文件-

PHP:发送电子邮件(文本/HTML/附件)

于 2013-09-19T17:30:14.907 回答