更新时间:2022-11-27 11:26:32
Using if( $ext !== 'gif'
) might not be efficient what if you allow like 20 different extensions
Try
$allowed = array('gif','png' ,'jpg');
$filename = $_FILES['video_file']['name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if(!in_array($ext,$allowed) ) {
echo 'error';
}