How can I protect users not to upload php scripts ?
I put the below codes into .htaccess of ( /uploads/ ) folder.
<Files ^(*.php|*.phps)>
order deny,allow
deny from all
</Files>
<FilesMatch "\.(php|pl|py|jsp|asp|htm|shtml|sh|cgi.+)$">
ForceType text/plain
</FilesMatch>
but i can still upload php files & php files are still executable. what's wrong with me or the codes ?
$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
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.