I've managed to be able to upload a temp file to the server after using the file upload function
but unsure on the next step of turning this into an attachment and sending it in an e-mail.
My idea is as followed:
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "You did not add your file.";
die();
}
if (($_FILES["file"]["type"] == "application/msword")
|| ($_FILES["file"]["type"] == "application/pdf")
|| ($_FILES["file"]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
&& ($_FILES["fileToUpload"]["size"] < 20480))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
$fname = "Joe";
$sname = "Bloggs";
$email = $_POST["email"];
$mail ="XXXXX@hotmail.co.uk";
//Sorting out the email to be sent to the user
$email_message = "Test: ". $_FILES["file"];
$mail = mail($mail,"Request From ".$fname." ".$sname,$email_message,"From: ".$email." <".$name." ".$sname.">");
}
}
else
{
echo "You tried to send a file that wasn't a word document. Please try again.";
}
?>
As you can guess it didn't work. Unsure on the next step though. Any help would be great

New Topic/Question
Reply




MultiQuote




|