well, I found and used this script to prevent other types of files:
PHP Code:
$allowedExtensions = array("jpg","jpeg","gif","png");
foreach ($_FILES as $file) {
if ($file['tmp_name'] > '') {
if (!in_array(end(explode(".",
strtolower($file['name']))),
$allowedExtensions)) {
$error .= "'.<li>Nuotrauka yra neleistino formato.</li>";
}
}
}
but still... I found out one bad thing. You can't upload image.php extention, but you can upload image.php.png which is allowed. And then user can write ../..link../image.php what will execute his php script from file, as well.
How I can evade this problem?
Just write whats on you mind. Thanks.
Bookmarks