• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/tradingplatform/sftp.php
  • Класс: BitrixSaleTradingPlatformSftp
  • Вызов: Sftp::uploadFile
public function uploadFile($localFile, $remoteFile)
{
	$remotePath = "sftp://".intval($this->sftp).$remoteFile;
	$stream = @fopen("ssh2.".$remotePath, 'w');

	if (!$stream)
		throw new SystemException(Loc::getMessage("TRADING_PLATFORM_SFTP_ERROR_OPEN_FILE", array("#FILE#" => $remotePath)));

	$data = file_get_contents($localFile);

	if ($data === false)
		throw new SystemException(Loc::getMessage("TRADING_PLATFORM_SFTP_ERROR_READ_FILE", array("#FILE#" => $localFile)));

	if (fwrite($stream, $data) === false)
		throw new SystemException(Loc::getMessage("TRADING_PLATFORM_SFTP_ERROR_WRITE_FILE", array("#FILE#" => $remotePath)));

	@fclose($stream);

	return true;
}