how to add file attachment(like pdf,doc,xml) in a contact form
<p>i have a contact form with out file attachment(its working properly) .How i can convert this contact form into file attachment.Can you also tell me how this file attachment script works.I tried web but there is no clear answer for this problem.this is my script</p>

<pre><code>&lt;form action="" enctype="multipart/form-data" method="post"&gt;

&lt;label for="name"&gt;Name:&lt;/label&gt;&lt;br/&gt;
&lt;input type="text" id="name" name="name" /&gt;&lt;br/&gt;

 &lt;label for="email"&gt;Email address:&lt;/label&gt;&lt;br/&gt;
 &lt;input type="text" id="email" name="email" /&gt;&lt;br/&gt;

 &lt;label for="topic"&gt;Subject:&lt;/label&gt;&lt;br/&gt;
&lt;input type="text" id="topic" name="topic" /&gt;&lt;br/&gt;
&lt;input type="hidden" name="MAX_FILE_SIZE" value="100000" /&gt;
&lt;label&gt;Upload a Menu:&lt;/label&gt;
&lt;input type="file" name="file" size="20"&gt;&lt;br&gt;


&lt;label for="comments"&gt;Your comments:&lt;/label&gt;&lt;br/&gt;
&lt;textarea id="comments" name="comments" rows="5" cols="30"&gt;&lt;/textarea&gt;&lt;br/&gt;

&lt;button name="submit" type="submit"&gt;Send&lt;/button&gt;

&lt;/form&gt;
&lt;?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 = 'example@gmail.com';
$subject = "Contact: $topic";
$message = "$name said: $comments";
$headers = "From: $email";

// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);

// Redirect
echo('&lt;br&gt; your mail has been send&lt;br&gt;');
}
?&gt;
</code></pre>
