如何保护用户不上传php脚本?
我把下面的代码放到。htaccess of (/uploads/)文件夹中。
<Files ^(*.php|*.phps)>
order deny,allow
deny from all
</Files>
<FilesMatch "'.(php|pl|py|jsp|asp|htm|shtml|sh|cgi.+)$">
ForceType text/plain
</FilesMatch>
但我仍然可以上传PHP文件&PHP文件仍然可以执行。我还是密码出了什么问题?
$allowed_ext = array("png","jpeg","gif");
$file_name = $_FILES['file']['name'];
$file_ext = end(explode(".",$file_name));
if(in_array($file_ext,$allowed_ext)){
//uplod_here;
}
else{
//reject
}