2

I'm trying to use phpseclib3 to upload a directory and its contents to a remote server. Perhaps its just not possible, but I've tried to do the following:

$sftp = new SFTP('ip');
$sftp->login('username', 'password');
$sftp->put('directory/*', 'directory/*', SFTP::SOURCE_LOCAL_FILE);

I've also tried without the / and with it, but without the *. Is there a way to easily upload the directory without needing to do it manually? i.e. creating a directory on remote server then looping through local directory uploading each file individually.

Asis
  • 319
  • 1
  • 2
  • 14
  • 2
    phpseclib does not support the uploading of directories like you describe but the code at https://stackoverflow.com/a/55143490/569976 (which would need to be adapted for phpseclib v3) should do the trick – neubert Mar 20 '23 at 14:52

0 Answers0