$uploadOk = 0; } if ($_FILES["logo"]["size"] > 800000000 || $_FILES["header"]["size"] > 80000000) { $msg .= " Contest media is too large."; $uploadOk = 0; } if ($contestLogoImg != '') { move_uploaded_file($_FILES["logo"]["tmp_name"], $targetLogo); } if ($contestHeaderImg != '') { move_uploaded_file($_FILES["header"]["tmp_name"], $targetHeader); } if ($uploadOk == 0) { $msg = "Sorry, your contest media was not uploaded. ERROR: " . $msg; $json = array("status" => 0, "msg" => $msg); $dbObj->close(); //Close Database Connection header('Content-type: application/json'); echo json_encode($json); } else { echo $contestObj->add(); } } else { $json = array("status" => 0, "msg" => $thisPage->showPlainErrors($errorArr)); $dbObj->close(); //Close Database Connection header('Content-type: application/json'); echo json_encode($json); } } }