• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/disk/sender.php
  • Класс: BitrixImDiskSender
  • Вызов: Sender::uploadFileToChatStorage
private function uploadFileToChatStorage()
{
	$fileIdWithPrefix = 'disk' . $this->file->getId();

	$attach = new CIMMessageParamAttach(null, CIMMessageParamAttach::CHAT);
	$attach->AddMessage($this->text);

	$uploadResult = CIMDisk::UploadFileFromDisk(
		$this->chat['ID'],
		[$fileIdWithPrefix],
		'',
		[
			'SYMLINK' => true,
			'PARAMS' => $this->params,
			'ATTACH' => $attach
		]
	);

	if (!$uploadResult || !isset($uploadResult['FILE_MODELS'][$fileIdWithPrefix]))
	{
		$this->errorCollection[] = new Error("Uploading file to chat error");

		return false;
	}

	return $uploadResult['FILE_MODELS'][$fileIdWithPrefix];
}