We use Gaufrette extensively, however, we hit a strange issue since a new client is using GlobalScape SFTP v7.1.8 and they cant upload the file. GlobalScape is a big EFT provider and this is a high profile project.
We have tried normal sftp client, winscp and with simple php script and they work with GlobalScape SFTP except Gaufrette.
I have narrow down this bit of code in Gaufrette throwing error "File does not exist or could not be created". Below is the place where it does not work "opendir" is the method that returns false
protected function ensureDirectoryExists($directory, $create = false)
{
$url = $this->sftp->getUrl($directory);
MainContainer::getLogger()->info($url);
$resource = @opendir($url);
if (false === $resource && (!$create || !$this->createDirectory($directory))) {
throw new \RuntimeException(sprintf('The directory \'%s\' does not exist and could not be created.', $directory));
}
// make sure we don't leak the resource
if (is_resource($resource)) {
closedir($resource);
}
}
I have tried with a bit of simple code that works fine with GlobalScape SFTP below
include('Net/SFTP.php');
$sftp = new Net_SFTP('localhost');
if (!$sftp->login('test', 'test')) {
exit('Login Failed');
}
// puts a three-byte file named filename.remote on the SFTP server
$sftp->put('filename.remote', 'xxx');
// puts an x-byte file named filename.remote on the SFTP server,
// where x is the size of filename.local
$sftp->put('openssl.cnf', 'openssl.cnf', NET_SFTP_LOCAL_FILE);
Hi,
We use Gaufrette extensively, however, we hit a strange issue since a new client is using GlobalScape SFTP v7.1.8 and they cant upload the file. GlobalScape is a big EFT provider and this is a high profile project.
We have tried normal sftp client, winscp and with simple php script and they work with GlobalScape SFTP except Gaufrette.
I have narrow down this bit of code in Gaufrette throwing error "File does not exist or could not be created". Below is the place where it does not work "opendir" is the method that returns false
protected function ensureDirectoryExists($directory, $create = false) { $url = $this->sftp->getUrl($directory); MainContainer::getLogger()->info($url); $resource = @opendir($url); if (false === $resource && (!$create || !$this->createDirectory($directory))) { throw new \RuntimeException(sprintf('The directory \'%s\' does not exist and could not be created.', $directory)); }
I have tried with a bit of simple code that works fine with GlobalScape SFTP below
include('Net/SFTP.php');
$sftp = new Net_SFTP('localhost'); if (!$sftp->login('test', 'test')) { exit('Login Failed'); }
// puts a three-byte file named filename.remote on the SFTP server $sftp->put('filename.remote', 'xxx'); // puts an x-byte file named filename.remote on the SFTP server, // where x is the size of filename.local $sftp->put('openssl.cnf', 'openssl.cnf', NET_SFTP_LOCAL_FILE);