• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/bitrix24disk/legacy/storagecontroller.php
  • Класс: BitrixDiskBitrix24DiskLegacyStorageController
  • Вызов: StorageController::processActionUpload
protected function processActionUpload()
{
	$this->checkRequiredFilesParams(array('file'));
	$this->checkRequiredPostParams(array('name'));

	if(
		$this->compareStringVersion(
			$_SERVER['CONTENT_LENGTH'],
			(string)min(CUtil::unformat(ini_get('upload_max_filesize')), CUtil::unformat(ini_get('post_max_size')))) > 0
	)
	{
		$this->sendJsonResponse(array('status' => self::STATUS_TOO_BIG));
	}

	if($this->errorCollection->hasErrors())
	{
		$this->sendJsonErrorResponse();
	}
	[$startRange, $endRange, $fileSize] = $this->getContentRange();

	$tmpFileManager = new Bitrix24DiskUploadFileManager();
	$tmpFileManager
		->setToken($this->request->getPost('token'))
		->setUser($this->getUser())
		->setFileSize($fileSize)
		->setContentRange(array($startRange, $endRange))
	;
	if(!$tmpFileManager->upload($this->request->getPost('name'), $this->request->getFile('file')))
	{
		$this->errorCollection->add($tmpFileManager->getErrors());

		if($this->errorCollection->getErrorByCode(Bitrix24DiskTmpFile::ERROR_CLOUD_APPEND_INVALID_CHUNK_SIZE))
		{
			$this->sendJsonResponse(array(
				'status' => self::STATUS_CHUNK_ERROR,
				'chunkSize' => $tmpFileManager->getChunkSize($this->request->getPost('name'), $fileSize),
			));
		}

		$this->sendJsonErrorResponse();
	}

	$this->sendJsonSuccessResponse(array(
		'token' => $tmpFileManager->getToken(),
	));
}