Forums / General Questions / Email Notifications

Email Notifications

Locked

Started by blackwolf on 21 Nov 2009, 10:07 PM · Views: 666

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
21 Nov 2009, 10:07 PM
#1
blackwolf avatar

blackwolf

New Zenner

Join Date:
Sep 2009
Location:
Liverpool
Posts:
96
Plugin Contributions:
0

Email Notifications

I have the following PHP code for a file upload on mysite. Can anyone provide me with what extra code I would need so the system sends me an email when a file is uploaded?

<?php

if ((($_FILES["file"]["type"] == "image/gif")

|| ($_FILES["file"]["type"] == "image/jpeg")

|| ($_FILES["file"]["type"] == "image/png")

|| ($_FILES["file"]["type"] == "image/pjpeg"))

&& ($_FILES["file"]["size"] < 2048000))

  {

  if ($_FILES["file"]["error"] > 0)

    {

    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";

    }

  else

    {

    echo "File Name: " . $_FILES["file"]["name"] . "<br />";

    echo "Type: " . $_FILES["file"]["type"] . "<br />";

    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
	
	echo "<hr width='75%'>";
	
	echo "<span id='gallery'>Thank you for your interest in our Gallery. If your image is successfully uploaded, please use our <a href='http://www.blackwolf-graphics.co.uk/index.php?main_page=contact_us'>Contact Us</a> form to let us know you have uploaded an image file and quote the file name <span id='file'>'". $_FILES["file"]["name"] ."'</span> and you'll receive your discount code within 12 hours.</span><br /><br />" . "<br />";




    if (file_exists("upload/" . $_FILES["file"]["name"]))

      {

      echo  "<span id='error'>'".$_FILES["file"]["name"] . "'<span id='error'> ALREADY EXISTS.</span><br><br><span id='errorsmall'>Please rename your file.</span> ";

      }

    else

      {

      move_uploaded_file($_FILES["file"]["tmp_name"],

      "upload/" . $_FILES["file"]["name"]);


      }

    }

  }

else

  {

echo "File Name: " . $_FILES["file"]["name"] . "<br />";

    echo "Type: " . $_FILES["file"]["type"] . "<br />";

    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  echo "<span id='error'>INVALID FILE TYPE OR SIZE</span><br><span id='gallery'>Please note only GIF,JPG,JPEG & PNG are allowed file types and up to a maximum of 2MB.<br><br>Please <a href='http://www.blackwolf-graphics.co.uk/index.php?main_page=page_2'>try again</a></span>";

  }

?>