TempFile::append

  1. Bitrix24 API (v. 23.675.0)
  2. ui
  3. TempFile
  4. append
  • Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/FileUploader/TempFile.php
  • Класс: BitrixUIFileUploaderTempFile
  • Вызов: TempFile::append
public function append(Chunk $chunk): Result
{
	$result = new Result();

	if ($chunk->getEndRange() < $this->getReceivedSize())
	{
		// We already have this part of the file
		return $result;
	}

	if ($this->getReceivedSize() !== $chunk->getStartRange())
	{
		return $result->addError(new UploaderError(UploaderError::INVALID_CHUNK_OFFSET));
	}

	if ($this->getReceivedSize() + $chunk->getSize() > $this->getSize())
	{
		return $result->addError(new UploaderError(UploaderError::CHUNK_TOO_BIG));
	}

	$result = $this->isCloud() ? $this->appendToCloud($chunk) : $this->appendToFile($chunk);
	if ($result->isSuccess())
	{
		$this->increaseReceivedSize($chunk->getSize());
	}

	// Remove a temporary chunk file immediately
	$chunk->getFile()->delete();

	return $result;
}

Добавить комментарий