thephpleague / flysystem

Abstraction for local and remote filesystems
https://flysystem.thephpleague.com
MIT License
13.33k stars 825 forks source link

LARAVEL - SFTP - How to disconnect SFTP connection after uploading the file? #1674

Closed gsofficework closed 6 months ago

gsofficework commented 1 year ago

I need help disconnecting the SFTP connection once the files are uploaded successfully.

Q A
Flysystem Version V3
Adapter Name SFTP
Adapter version -

I have the following code to connect SFTP for each file upload using Laravel.

$driver = Storage::createSFtpDriver([
    'driver'   => 'sftp',
    'host'     => 'sftp.test.com',
    'username' => 'test-gopal@sftp.test.com',
    'password' => '123456',
    'timeout'  => 60,
]);

$driver->put($destinationPath, file_get_contents($localPath));

Please help me to find a way to disconnect the SFTP connection once the files are uploaded.

TIA

realtebo commented 1 year ago

Same problem here !

I remember in the past we could force disconnect manually Actually there is no more any public disconnect function

frankdejonge commented 6 months ago

Recently, a disconnect method is added to the SFTP adapter.