// проверяем тип файла $types = $cfg['filestype'] ? $cfg['filestype'] : 'jpeg,gif,png,jpg,bmp,zip,rar,tar'; $types = str_replace('php', '', $types); $types = str_replace('htm', '', $types); $types = str_replace('htaccess', '', $types); $maytypes = explode(',', str_replace(' ', '', $types)); $path_parts = pathinfo($name); // расширение файла $ext = strtolower($path_parts['extension']); // флаг существования расширения в разрешенных $may = in_array($ext, $maytypes); if(!$may) { cmsCore::addSessionMessage($_LANG['ERROR_TYPE_FILE'].': '.$types, 'error'); $inCore->redirectBack(); }
test.php%00.jpg
Array ( [dirname] => . [basename] => test.php�.jpg [extension] => jpg [filename] => test.php )