Skip to content

Instantly share code, notes, and snippets.

@shameerc
Created August 6, 2010 05:13
Show Gist options
  • Save shameerc/510878 to your computer and use it in GitHub Desktop.
Save shameerc/510878 to your computer and use it in GitHub Desktop.
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
{
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"];
}
}
else
{
echo "Invalid file";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment