barryvdh / elfinder-flysystem-driver

elFinder driver for Flysystem
184 stars 41 forks source link

Error Alert when upload File using SFTP, the File is success uploaded #33

Closed xian13 closed 8 years ago

xian13 commented 8 years ago

The _resultPath in the Driver always return false because of

if (! is_array($result)) {
    if ($this->fscache) {
        $this->fscache->flush();
    }
    $result = $this->fs->getMetaData($requestPath);
}

when using SFTPAdapter the result is only boolean and getMetaData does not return path and only return :

[
    'timestamp' => 123123,
    'size' => 123123,
    'type' => 'file',
    'visibility' =? 'public'
]

so that this

$path = ($result && isset($result['path']))? $result['path'] : false;

will always return false.

Does the getMetaData of SFTP must return path? If yes, then the issue is in SFTPAdapter, any suggestion?

Thank you.

barryvdh commented 8 years ago

ping @nao-pon

nao-pon commented 8 years ago

OK, I'll review.

barryvdh commented 8 years ago

@nao-pon Thanks @xian13 Does the above commit fix it for you?

xian13 commented 8 years ago

@barryvdh @nao-pon I've tried it and it works, thank you so much for both of you

nao-pon commented 8 years ago

@xian13 , @barryvdh Sure! :smile:

cicciomaltese commented 5 years ago

Hello everyone, reading the tread I understand that you have managed to configure elfinder to read an sftp volume. I'm unfortunately freaking out, could you give me a hand? I did these steps to install elfinder:

  1. curl -sSL https://studio-42.github.io/elFinder/tools/installer/setup_with_composer/setup_with_composer.sh | bash

  2. composer require barryvdh/elfinder-flysystem-driver

and then I modified the connector.php file by entering the data for the sftp volume:

`'driver' => 'Flysystem', 'URL' => 'http://mydomain.com/content', 'alias' => 'Mydomain.com', 'filesystem' => new Filesystem (new Ftpd ( [ 'host' => 'sftp-host', 'username' => 'user', 'password' => 'pass', 'Port' => 22, // 'mode' => 'passive' // 'ssl' => true

] )),`

but I still can't connect. Some idea?