function getStage() { $stage = stage(); return $stage; }
$id = $_POST['edit_stage_key']; $target_dir = '../../assets/img/stage/'; $fn = $_FILES["edit_stage_image"]["name"]; $target_file = $target_dir . basename($fn); $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); if (!empty($fn)) { $file = $_FILES['edit_stage_image']; $check = getimagesize($_FILES["edit_stage_image"]["tmp_name"]); if ($check !== false) { $file_path = $target_dir . $file['name']; move_uploaded_file($file['tmp_name'], $file_path); $image = $file['name']; //call function to modify Stage Decoration updateStage($name, $cost, $image, $id); } } else { updateStageWithoutImage($name, $cost, $id); } //return updated Stage informations $row = stage(); $resp = $row; echo json_encode($resp); } elseif (isset($_POST['stageKey'])) { // delete stage info $id = $_POST['stageKey']; deleteStage($id); //return updated Stage informations $row = stage(); $resp = $row; echo json_encode($resp); }