protected function processActionUpload() { static $uploader = null; if ($uploader === null) { $uploader = new \CFileUploader(array("events" => array("onFileIsUploaded" => array($this, "processActionHandleFile"))), "get"); } $uploader->checkPost(); }
{ echo CUtil::PhpToJsObject(Array( 'ERROR' => 'UPLOAD_ERROR' )); } } else if ($_POST['IM_FILE_UPLOAD'] == 'Y') { CUtil::decodeURIComponent($_POST); $CFileUploader = new CFileUploader(array( "allowUpload" => "A", "events" => array( "onFileIsUploaded" => array("CIMDisk", "UploadFile") ) )); if (!$CFileUploader->checkPost()) { echo CUtil::PhpToJsObject(Array( 'ERROR' => 'UPLOAD_ERROR' )); } } else if ($_POST['IM_FILE_REGISTER'] == 'Y') { $errorMessage = ''; CUtil::decodeURIComponent($_POST); $_POST['FILES'] = CUtil::JsObjectToPhp($_POST['FILES']); $result = CIMDisk::UploadFileRegister($_POST['CHAT_ID'], $_POST['FILES']); if (!$result) {
protected function processActionUploadFile() { static $uploader = null; if ($uploader === null) { $uploader = new \CFileUploader(array("events" => array("onFileIsUploaded" => array($this, "processActionHandleFile"))), "get"); } if (!$uploader->checkPost() && check_bitrix_sessid() && $this->request->getFile("disk_file")) { $file = $this->request->getFile("disk_file") + array("files" => array("default" => $this->request->getFile("disk_file"))); if ($this->processActionHandleFile($hash = "", $file, $package = array(), $upload = array(), $error = array())) { unset($file["files"]); unset($file["tmp_name"]); $this->sendJsonResponse(array('status' => self::STATUS_SUCCESS, 'data' => $file)); } else { $this->sendJsonResponse(array('status' => self::STATUS_ERROR, 'message' => $error)); } } }