• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/localdocumentcontroller.php
  • Класс: Bitrix\Disk\Document\LocalDocumentController
  • Вызов: LocalDocumentController::processActionCommit
protected function processActionCommit()
{
	$this->checkRequiredFilesParams(array('file'));
	if($this->errorCollection->hasErrors())
	{
		$this->sendJsonErrorResponse();
	}
	$this->checkUpdatePermissions();

	//todo fix Cherezov. Ban encoding 1251
	$fileArray = $this->request->getFile('file');
	$fileArray['name'] = $this->file->getName();
	$userId = $this->getUser()->getId();
	if(!$this->file->uploadVersion($fileArray, $userId))
	{
		$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_LOCAL_DOC_CONTROLLER_ERROR_COULD_NOT_ADD_VERSION'), self::ERROR_COULD_NOT_ADD_VERSION)));
		$this->sendJsonErrorResponse();
	}

	Driver::getInstance()->sendEvent($userId, 'live', array(
		'objectId' => $this->file->getId(),
		'action' => 'commit',
	));

	$this->sendJsonSuccessResponse();
}