Skip to content

Instantly share code, notes, and snippets.

@lordSerega

lordSerega/test Secret

Created September 6, 2020 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lordSerega/d8ab7d0196b29e634de3932f04f72616 to your computer and use it in GitHub Desktop.
Save lordSerega/d8ab7d0196b29e634de3932f04f72616 to your computer and use it in GitHub Desktop.
if (!empty($_POST)) {
$image = $_FILES['image']['name'];
$target = "img/".basename($image);
if (move_uploaded_file($_FILES['image']['tmp_name'], $target)){
[$imageWidth, $imageHeight] = getimagesize($target);
if ($imageWidth <= 300 && $imageHeight <= 300) {
echo "Файл больше";
} else {
$this->db->query("INSERT INTO post (title,postDate,preview,textFull,postIMG) VALUES(?,?,?,?,?)", $_POST['title'], $_POST['postDate'], $_POST['preview'], $_POST['full'],$image);
header("Location: /");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment