public function action_postAddPhoto() { $targetDir = "/assets/uploads/"; try { Model_Photo::validate($_POST, $_FILES, $this->user); $target_file = $targetDir . basename($_FILES["file"]["name"]); $photo = new Model_Photo(); $photo->add($_POST, $_FILES); Session::set('message', "Zdjęcie zostało dodane."); $this->redirect("/index.php/photos"); } catch (Validation_Exception $exception) { $this->content = new View("photos/addPhoto"); $this->content->passData('user', $this->user); $this->content->passData('isLogged', $this->user != null); $this->content->passData('errorField', $exception->field); $this->content->passData('error', $exception->error); } }