if (!isset($_FILES['file']['size'])) { $_FILES['file']['size'] = null; } if (!isset($_FILES['file']['type'])) { $_FILES['file']['type'] = null; } // $id, $personId, $caption, $avatar, $fileName, $fileType, $fileTmpName, $fileSize $cImage = new ImageController((int) $_POST['id'], $_POST['personId'], $_POST['caption'], $avatar, $_FILES['file']['name'], $_FILES['file']['type'], $_FILES['file']['tmp_name'], $_FILES['file']['size']); // // if( ($cImage->imageFieldValidate()->$validate['jpeg'] == 1) && ($cImage->imageFieldValidate()->$validate == 1) ) { if (isset($_GET['action']) && $_GET['action'] === 'create') { $validate = $cImage->imageFieldValidate(); if ($validate['jpeg'] === 1 && $validate['fileSize'] === 1) { $cImage->upload($cImage); header("Location: ../addphotos.php?id=" . $_POST['personId'] . "&action=update"); } else { header("Location: ../addphotos.php?id=" . $_POST['personId'] . "&validate=error&action=update"); } } if (isset($_GET['action']) && $_GET['action'] === 'update') { $model = new ImagePDO(); $model->updateById($cImage); header("Location: ../editphotos.php?id=" . $_POST['personId'] . "&action=update"); } } if (isset($_GET['action']) && $_GET['action'] == 'delete') { $deleteId = (int) $_GET['id']; $cImage = new ImagePDO(); $cImage->deleteById($deleteId); header("Location: ../editphotos.php?id=" . $_GET['personId'] . "&action=update"); }