Home >Backend Development >PHP Tutorial >Sixth grade Chinese courseware for the first volume of PHP upload file type judgment function to avoid upload loopholes
Copy the code The code is as follows:
function ($file_name,$pass_type=array('jpg','jpeg','gif','bmp','png')){
$yx_file = $ pass_type;
$kzm = substr(strrchr($file_name,"."),1);
$is_img = in_array(strtolower($kzm),$yx_file);
if($is_img){
return true;
} else{
return false;
}
}
The above introduces the PHP upload file type judgment function to avoid upload loopholes in the Chinese courseware for the sixth grade, volume one, including the contents of the Chinese courseware for the sixth grade, volume one. I hope it will be helpful to friends who are interested in PHP tutorials.