Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save sftp file to local storage, return false #102

Open
raulfdias opened this issue Feb 3, 2020 · 2 comments
Open

Save sftp file to local storage, return false #102

raulfdias opened this issue Feb 3, 2020 · 2 comments

Comments

@raulfdias
Copy link

Hello guys!
I have a problem regarding trying to save an sftp file to my localstorage. False is returned when I get the file. Follow:

$file = "image.png";
Storage :: disk('sftp')->exists ($file); // retrun true
Storage :: disk('sftp')->get($file); // return false

Config:
'sftp' => [
'driver' => 'sftp',
'host' => 'sftp.lalala.m.br',
'username' => 'src_lt',
'password' => '6324Easdf3wE4',

        // Settings for SSH key based authentication ...
        // 'privateKey' => '/ path / to / privateKey',
        // 'password' => 'encryption-password',

        // Optional SFTP Settings ...
        'port' => 22,
        // 'root' => '/ FOLDER /',
        'timeout' => 1200,

        // 'cache' => [
        // 'store' => 'database',
        // 'exhale' => 600,
        // 'prefix' => 'sftp_cache_',
        //],
    ],
@raulfdias raulfdias changed the title save sftp file to local storage error Save sftp file to local storage, return false Feb 3, 2020
@raulfdias
Copy link
Author

By doing everything by hand, you can easily manipulate the file. Now when using the library it doesn't work.

$connection = ssh2_connect('sftp.com.br', 22);
ssh2_auth_password($connection, 'user', 'pass');
$sftp = ssh2_sftp($connection);
$stream = fopen('ssh2.sftp://' . intval($sftp) . '/path/file.csv', 'r');
$content = fread($stream, filesize('ssh2.sftp://' . intval($sftp) . '/path/file.csv'));
fclose($stream);

Storage::disk('local')->put('file.csv', $content);

Is there any parameter that I would need to pass on this connection ??

@vladan-me
Copy link

Find the directory where is the file saved and check the permissions and the owner of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants