• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/ui/uploader/uploader.php
  • Класс: BitrixMainUIUploaderUploader
  • Вызов: Uploader::getPaths
static function getPaths($tmpName)
{
	$docRoot = null;
	$io = CBXVirtualIo::GetInstance();
	if (($tempRoot = CTempFile::GetAbsoluteRoot()) && ($strFilePath = $tempRoot.$tmpName) &&
		$io->FileExists($strFilePath) && ($url = File::getUrlFromRelativePath($tmpName)))
	{
		return array(
			"tmp_url" => $url,
			"tmp_name" => $strFilePath
		);
	}
	else if ((($docRoot = BitrixMainApplication::getInstance()->getContext()->getServer()->getDocumentRoot()) && $strFilePath = $docRoot.$tmpName) && $io->FileExists($strFilePath))
	{
		return array(
			"tmp_url" => $tmpName,
			"tmp_name" => $strFilePath
		);
	}
	else if ($io->FileExists($tmpName) && ($docRoot = BitrixMainApplication::getInstance()->getContext()->getServer()->getDocumentRoot()) &&
		mb_strpos($tmpName, $docRoot) === 0)
	{
		return array(
			"tmp_url" => str_replace("//", "/", "/".mb_substr($tmpName, mb_strlen($docRoot))),
			"tmp_name" => $tmpName
		);
	}
	return false;
}