怎么用php写禁止上传exe文件格式

怎么用php写禁止上传exe文件格式,写出代码,最好写完整点

$not_allowed = array('php', 'php5', 'exe');

if(in_array($extension, $not_allowed)){
    echo 'File not allowed';
}else{
    echo 'File allowed';
}

文件都有mime_type,获取到后 做个判断!楼上的就是现成的代码!

一个是判断后缀名是否有exe
一个是判断文件开头两个字符是不是MZ