Hi,

  • In my site I have a form which anyone can submit details via e-mail.
  • Since I want to get more details, I leave a space to upload a document.then visitor can browse & upload the details.

Please can anyone tell me how can I receive the uploaded document as a e-mail attachment???
This is my code. please help me by modifying my code to receive the document as e-mail attachment.

code from contact.html

<form method="post" action="sendeail.php">
Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br />
Please attach your details:<br>
<input type="file" name="attachment" size="23">
<br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<br />
<input type="submit" value="Send Mail" />
<br />
</form>

code from sendeail.php

<?php

$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];

$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n

Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n";
$from = "From: $visitormail\r\n";

mail("hadunperera@yahoo.com", $subject, $message, $from);

?>

please help me. thank you

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.