note 104124 modified in function.ssh2-scp-recv by danbrown
| From: | danbrown@php.net | Date: | Wed, 25 May 2011 13:02:23 +0000 |
| Subject: | note 104124 modified in function.ssh2-scp-recv by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180020@lists.php.net to get a copy of this message | ||
Trying to get a remote file with spaces in its name?
Never forget to use quotes in the remote filename, but never in the local one.
Example:
<?php
$remote_file_name="my name with spaces.ext"
ssh2_scp_recv($cn,$remote_file_name,$local_path."/".$remote_file_name); // ERROR
ssh2_scp_recv($cn,"\"".$remote_file_name."\"",$local_path."/".$remote_file_name);
//OK
ssh2_scp_recv($cn,"\"".$remote_file_name."\"","\"".$local_path."/".$remote_file_name."\"");
//ERROR
?>
So, the quotes in the file name are needed only for remote, not for local.
--was--
Trying to get a remote file with spaces in its name?
Never forget to use quotes in the remote filename, but never in the local one.
Example:
$remote_file_name="my name with spaces.ext"
ssh2_scp_recv($cn,$remote_file_name,$local_path."/".$remote_file_name); // ERROR
ssh2_scp_recv($cn,"\"".$remote_file_name."\"",$local_path."/".$remote_file_name);
//OK
ssh2_scp_recv($cn,"\"".$remote_file_name."\"","\"".$local_path."/".$remote_file_name."\"");
//ERROR
So, the quotes in the file name are needed only for remote, not for local.
http://php.net/manual/en/function.ssh2-scp-recv.php