• Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/FileUploader/TempFile.php
  • Класс: BitrixUIFileUploaderTempFile
  • Вызов: TempFile::appendToFile
private function appendToFile(Chunk $chunk): Result
{
	$result = new Result();
	$file = new IOFile($this->getAbsoluteLocalPath());

	if ($chunk->isFirst() || !$file->isExists())
	{
		return $result->addError(new UploaderError(UploaderError::FILE_APPEND_NOT_FOUND));
	}

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

	if (!$chunk->getFile()->isExists())
	{
		return $result->addError(new UploaderError(UploaderError::CHUNK_APPEND_NOT_FOUND));
	}

	if ($file->putContents($chunk->getFile()->getContents(), IOFile::APPEND) === false)
	{
		return $result->addError(new UploaderError(UploaderError::CHUNK_APPEND_FAILED));
	}

	return $result;
}