Hi Reader's,
Welcome to FindNerd, today we are going to discuss How to upload restrict file in PHP ?
If you want upload only jpg, gif image and other type of images not allow to upload
then, you have to use bellow php code:
<?php
//here define which file you want allow
$image_Type = array("image/jpg", "image/gif", "image/png");
// check availbility
if($image_Type != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" )
{
echo "Sorry! only JPG, PNG & GIF files are allowed try again.";
$Uploadok = 0;
}
?>
output will come following of above example
Sorry! only JPG, PNG & GIF files are allowed try again.
0 Comment(s)