/** * Uploads user's profile picture. */ public function action() { checkUnauthorizedAccess(); $main = new Main(); $main->setPageTitle("Change profile picture"); $profilePic = new UploadProfilePicture(); $main->setBody($profilePic); echo $main; $username = $_SESSION['username']; if (post('submit')) { move_uploaded_file($_FILES['file']['tmp_name'], "assets/images/profile/" . $_FILES['file']['name']); UserRepository::setProfilePicture($username); } }