• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/ui/uploader/file.php
  • Класс: BitrixMainUIUploaderFile
  • Вызов: File::viewFile
static function viewFile($cid, $hash, $path)
{
	$file = false;
	$copy = "";
	if (mb_strpos($hash, "_") > 0)
	{
		$copy = explode("_", $hash);
		$hash = $copy[0]; $copy = $copy[1];
	}
	$copy = ($copy ?:"default");
	if (FileInputUtility::instance()->checkFile($cid, $hash))
	{
		$file = self::getFromCache($hash, $path);
		$file = $file["files"][$copy];
	}

	if (is_array($file))
	{
		$docRoot = Application::getInstance()->getContext()->getServer()->getDocumentRoot();
		if (mb_strpos(CTempFile::GetAbsoluteRoot(), $docRoot) === 0)
			CFile::ViewByUser($file, array("content_type" => $file["type"]));
		else
			self::view($file, array("content_type" => $file["type"]));
	}
}