Admin_UserController::uploadImageAction PHP Метод

uploadImageAction() публичный Метод

public uploadImageAction ( )
    public function uploadImageAction()
    {
        if ($this->getParam("id")) {
            if ($this->getUser()->getId() != $this->getParam("id")) {
                $this->checkPermission("users");
            }
            $id = $this->getParam("id");
        } else {
            $id = $this->getUser()->getId();
        }
        $userObj = User::getById($id);
        if ($userObj->isAdmin() && !$this->getUser()->isAdmin()) {
            throw new \Exception("Only admin users are allowed to modify admin users");
        }
        $userObj->setImage($_FILES["Filedata"]["tmp_name"]);
        $this->_helper->json(["success" => true], false);
        // set content-type to text/html, otherwise (when application/json is sent) chrome will complain in
        // Ext.form.Action.Submit and mark the submission as failed
        $this->getResponse()->setHeader("Content-Type", "text/html");
    }