• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/import/import.php
  • Класс: BitrixSaleLocationImportImportProcess
  • Вызов: ImportProcess::saveUserFile
public function saveUserFile($inputName)
{
	if(is_array($_FILES[$inputName]))
	{
		if($_FILES[$inputName]['error'] > 0)
			throw new MainSystemException(self::explainFileUploadError($_FILES[$inputName]['error']));

		if(!in_array($_FILES[$inputName]['type'], array(
			'text/plain',
			'text/csv',
			'application/vnd.ms-excel',
			'application/octet-stream'
		)))
		{
			throw new MainSystemException('Unsupported file type');
		}

		self::cleanWorkDirectory();

		if(!copy($_FILES[$inputName]['tmp_name'], $_SERVER['DOCUMENT_ROOT'].self::LOCAL_PATH.self::getFileNameByIndex(0)))
		{
			$lastError = error_get_last();
			throw new MainSystemException($lastError['message']);
		}
	}
	else
		throw new MainSystemException('No file were uploaded');
}