Возникла новая проблема в данном коде. Если картинку не выбрали, то всё норм, запрос проходит, скрипт выполняется, а если выбрали - то запрос проходит, но картинка не добавляется. Код: if(isset($_GET['add'])){
$text = htmlspecialchars(trim($_POST['text']));
$time = time();
if(isset($_POST['screen'])){
$blacklist = array(".php", ".phtml", ".php3", ".php4", ".html", ".htm");
foreach ($blacklist as $item)
if(preg_match("/$item\$/i", $_FILES['screen']['name'])) exit;
$type = $_FILES['screen']['type'];
$size = $_FILES['screen']['size'];
if (($type != "image/jpg") && ($type != "image/jpeg") && ($type != "image/gif") && ($type != "image/png")) exit;
if ($size > 2200000) exit;
$uploadfile = "images/screens/".$_FILES['screen']['name'];
move_uploaded_file($_FILES['screen']['tmp_name'], $uploadfile);
$db->query("INSERT INTO `forum_post` (`author`,`text`,`time`,`screen`,`topic`,`size`) VALUES ('".$user['id']."', '".$text."', '".$time."', '".$_FILES['screen']['name']."', '".$id."', '".$_FILES['screen']['size']."')");
}else{
$db->query("INSERT INTO `forum_post` (`author`,`text`,`time`,`topic`) VALUES ('".$user['id']."', '".$text."', '".$time."', '".$id."')");
}
header("Location: /topic/id".$id."");
exit;
}
В чём может быть трабла?