ok.
This is what I get after clicking submit:
You’ve got a message for FREE sample of Partymagnets.ca
Full name: asda
Address: dasjkd
City: jkdaksndkn
PostalCode: dnas,d
Caption on Magnet: dsa,d
Phone number: 123
Email Address: [email protected]
Path: uploads/
And this is the uploadFile.php file code:
[php]
<?php
$submit = $_POST['submit'];
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path))
{
echo "The file ". basename( $_FILES['file']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
echo $target_path . "
";
if($submit)
{
$name = $_POST['fullname'];
$address = $_POST['address'];
$postalcode = $_POST['postalcode'];
$city = $_POST['city'];
$caption = $_POST['caption'];
$phone = $_POST['phone'];
$email = $_POST['email'];
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
";
if ((($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/jpeg"))
&& ($_FILES["file"]["size"] < 2000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
"; }
}
else
{
echo "Invalid file";
}
if(!$name || !$address || !$city)
{
echo <<<HTML
Please fill out all the mandatory fields.
HTML;
}
else
{
$mess = <<<HTML
--------------------------------------------------------
You've got a message for FREE sample of Partymagnets.ca
--------------------------------------------------------
Full name: {$name}
Address: {$address}
City: {$city}
PostalCode: {$postalcode}
Caption on Magnet: {$caption}
Phone number: {$phone}
Email Address: {$email}
Path: {$target_path}
-----------------------------------------------
HTML;
mail("
[email protected]","Email from Partymagnets.ca - FREE sample",$mess);
echo <<<HTML
Thank you, We will send you the FREE magnet sample within 5 business days.
HTML;
}
}
else
{
header("location: freeMagnetSample.html");
}
?>
[/php]
hope it is not too messy…