public function changePhotoAction() { header('Content-Type: application/json; charset=utf-8'); header('Cache-Control: no-store, no-cache'); header('Expires: ' . date('r')); $this->clearAvatarAction(); $model = new UserUpdateTableModel(); $model->setTable('user'); $userId = Session::get('user_id'); $model->setId($userId); $model->setPath(Path::USERIMG_UPLOAD_DIR); $model->setPhoto($_FILES['files']['name'][0]); $model->updateAvatar(); $upload_handler = new UploadHandler(['upload_dir' => Path::USERIMG_UPLOAD_DIR, 'max_number_of_files' => 1, 'user_dirs' => true, 'isAvatar' => true]); }