Hello,
Sorry im a newbie to PHP…
My script below takes user input from my html form and emails the results to me…
On my form i have an upload form field, and wish for the end user to be able to upload an image which i want either attached to, or preferabally to be part of the body on the email message!
(As you can se i have managed to get the PHP file to take the uploaded image and place it in a directory…my problem is…how to send the mail with that picture attached or part of the email body?)
<?php
$file_dir = $_SERVER['DOCUMENT_ROOT'] . '/terry/uploads/';
$name = $_REQUEST['name'] ;
$phone = $_REQUEST['telephone'] ;
foreach($_FILES as $file_name => $file_array) {
if (is_uploaded_file($file_array["tmp_name"])) {
move_uploaded_file($file_array["tmp_name"], "$file_dir/".$file_array["name"]) or die ("Couldn't copy");
}
}
$string = "T-Shirt order form....
";
$string .= "Name: ".$name."
";
$string .= "Telephone Number: ".$phone."
";
$string .= "T-Shirt Design"."
";
mail("root@thanweb.co.uk", "Website - T-Shirt Order", $string, "From: root@thanweb.co.uk", "-froot@thanweb.co.uk");
header( "Location: http://www.thanweb.co.uk/thankyou.htm" );
?>