I'm using PHP_SSH2 version 1.1.2 (and phpseclib version 1.0.11) and when trying to upload files, I get this error:
PHP Fatal error: Uncaught error: Call to undefined method Net_SSH2::put()
Here is the code I'm using:
require 'Net/SSH2.php';
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
$connection = new Net_SSH2($ftp_server);
if(!$connection->login($ftp_user_name, $ftp_user_pass)){
die("FTP connection has failed!
Attempted to connect to $ftp_server for user $ftp_user_name");
}
$source_file = 'filename.txt';
$destination_file = $source_file;
$upload = $connection->put($destination_file, $source_file, NET_SFTP_LOCAL_FILE);
if (!$upload) die("FTP upload of $source_file has failed!");
I can connect to the server okay (so login()
works), but put()
doesn't?