if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}
The code above checks to be sure the user is not uploading a PHP file to your site. If they do upload a PHP file, they are given an error, and $ok is set to 0.
if (!($uploaded_type=="image/gif"))
{
echo "You may only upload GIF files.<br>";
$ok=0;
}
In our second example we only allow users to upload .gif files, and all other types are given an error before setting $ok to 0. You can use these basic examples to allow or deny any specific file types.