ファイルが機能する以下のコードを使用して、同じコンピューター上のあるフォルダーから別のフォルダーにファイルを転送できます。
$file = 'pdf.pdf';
$source_path = 'source/';
$target_path = 'target/';
if (! copy($source_path . $file, $target_path . $file))
{
exit('Failed to copy ' . $source_path . $file);
}
echo $source_path . $file . ' file copied to ' . $target_path . $file;
SFTP-SSHを使用するリモートLinuxサーバーに同じファイルを転送するにはどうすればよいですか? 誰かに尋ねられたら、cURL()、ftp_get()、stream_copy_to_stream()、ssh2_sftp()、scp() のロジックを理解するための多くの例を見つけましたが、これまでにやったことがないので達成できませんでした。
注: 以下の私の設定は、FileZilla で正常に機能します。
target host: https://192.168.32.1/test_folder/
target host: https://mysite.site.com/test_folder/
protocol: SFTP-SSH
port: 2281
username: myusername
password: mypassword
ありがとう