0
我有一個帶有文件附件(工作正常)的聯繫表單。如何將此聯繫人表單轉換爲文件附件。您還可以告訴我這個文件附件腳本works.I如何試圖網站,但沒有明確的答案這個problem.this是我的腳本如何在聯繫人表單中添加文件附件(如pdf,doc,xml)
<form action="" enctype="multipart/form-data" method="post">
<label for="name">Name:</label><br/>
<input type="text" id="name" name="name" /><br/>
<label for="email">Email address:</label><br/>
<input type="text" id="email" name="email" /><br/>
<label for="topic">Subject:</label><br/>
<input type="text" id="topic" name="topic" /><br/>
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<label>Upload a Menu:</label>
<input type="file" name="file" size="20"><br>
<label for="comments">Your comments:</label><br/>
<textarea id="comments" name="comments" rows="5" cols="30"></textarea><br/>
<button name="submit" type="submit">Send</button>
</form>
<?php
if(isset($_POST['submit']))
{
// Pick up the form data and assign it to variables
$name = $_POST['name'];
$email = $_POST['email'];
$topic = $_POST['topic'];
$comments = $_POST['comments'];
// Build the email (replace the address in the $to section with your own)
$to = '[email protected]';
$subject = "Contact: $topic";
$message = "$name said: $comments";
$headers = "From: $email";
// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);
// Redirect
echo('<br> your mail has been send<br>');
}
?>