Please help with php code:
I have following code what makes only 360×514 images to be uploaded only.
My question is: how can I edit it to make any size uploadable without error message?
<?php
$MAXIMUM_FILESIZE = 5 * 1024 * 1024;
$uploaddir = './uploads/image/large_image/';
$file = $uploaddir . basename($_FILES['image2']['name']);
$raw_file_name= $_FILES['image2']['tmp_name'];
list($width, $height) = getimagesize($_FILES['image2']['tmp_name']);
if ($width==360 && $height==514) {
if (move_uploaded_file($_FILES['image2']['tmp_name'], $file)) {
echo "success";
}
else {
echo "error";
}
}else {
echo "size_error";
}
?>
Like @Musa says, remove the check:
It is right in your code if you read it… Here it says that it has to be equal to 360×514, just get rid of that IF statement, and just skip to the move_uploaded_file command.