• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/base.php
  • Класс: Bitrix\Crm\Controller\Base
  • Вызов: Base::uploadFile
protected function uploadFile(Field $field, $fileContent): ?int
{
	if (empty($fileContent))
	{
		return null;
	}

	$fileArray = \CRestUtil::saveFile($fileContent);
	if (!$fileArray)
	{
		$this->addError(new Error(Loc::getMessage('CRM_CONTROLLER_BASE_UPLOAD_FILE_ERROR')));
		return null;
	}

	return Container::getInstance()->getFileUploader()->saveFileTemporary($field, $fileArray);
}