/** * Triggers a file upload to the Flexiskin data directory defined by id via request parameter * @return AjaxResponse The AjaxResponse Object */ public function uploadFile() { $sId = $this->getMain()->getVal('id', ''); if ($sId == "") { return FormatJson::encode(array('success' => false, 'msg' => wfMessage('bs-flexiskin-api-error-missing-param', 'id')->plain())); } $sName = $this->getMain()->getVal('name', ''); if ($sId == "") { return FormatJson::encode(array('success' => false, 'msg' => wfMessage('bs-flexiskin-api-error-missing-param', 'name')->plain())); } $oStatus = BsFileSystemHelper::uploadFile($sName, "flexiskin" . DS . $sId . DS . "images"); if (!$oStatus->isGood()) { $aResult = FormatJson::encode(array('success' => false, 'msg' => "err_cd:" . $oStatus->getMessage())); } else { $aResult = FormatJson::encode(array('success' => true, 'name' => $oStatus->getValue())); } return $aResult; }