private function operationSftp($operation)
    {
        $config = $this->operationFtpConfig($operation);

        $adapter    = new SftpAdapter($config);
        $filesystem = new Filesystem($adapter);

        $written = false;
        if ($stream = fopen($this->file->getLocation(), 'r+')) {
            $this->setLogs($this->file->getLocation(), 'sftpUploading');
            $written = $filesystem->writeStream($this->file->getName(), $stream);
            if (is_resource($stream)) {
                fclose($stream);
            }
            $this->setLogs($written, 'sftpConfirmed');
            if (!$written) {
                $this->setLogs('Could not confirm file upload via SFTP', 'error');
            } else {
                $this->setLogs($filesystem->has($this->file->getName()), 'sftpConfirmed2');
            }
        } else {
            $this->setLogs('Unable to open file for upload via SFTP.', 'error');
        }

        return $written;
    }
private function operationSftp($operation)
    {
        $config = $this->operationFtpConfig($operation);

        $adapter    = new SftpAdapter($config);
        $filesystem = new Filesystem($adapter);

        $written = false;
        if ($stream = fopen($this->file->getLocation(), 'r+')) {
            $this->setLogs($this->file->getLocation(), 'sftpUploading');
            $written = $filesystem->writeStream($this->file->getName(), $stream);
            if (is_resource($stream)) {
                fclose($stream);
            }
            $this->setLogs($written, 'sftpConfirmed');
            if (!$written) {
                $this->setLogs('Could not confirm file upload via SFTP', 'error');
            } else {
                $this->setLogs($filesystem->has($this->file->getName()), 'sftpConfirmed2');
            }
        } else {
            $this->setLogs('Unable to open file for upload via SFTP.', 'error');
        }

        return $written;
    }
private function operationSftp ( $ operation ) { $ config = $ this -> operationFtpConfig ( $ operation ) ; $ adapter = new SftpAdapter ( $ config ) ; $ filesystem = new Filesystem ( $ adapter ) ; $ written = false ; if ( $ stream = fopen ( $ this -> file -> getLocation ( ) , 'r+' ) ) { $ this -> setLogs ( $ this -> file -> getLocation ( ) , 'sftpUploading' ) ; $ written = $ filesystem -> writeStream ( $ this -> file -> getName ( ) , $ stream ) ; if ( is_resource ( $ stream ) ) { fclose ( $ stream ) ; } $ this -> setLogs ( $ written , 'sftpConfirmed' ) ; if ( ! $ written ) { $ this -> setLogs ( 'Could not confirm file upload via SFTP' , 'error' ) ; } else { $ this -> setLogs ( $ filesystem -> has ( $ this -> file -> getName ( ) ) , 'sftpConfirmed2' ) ; } } else { $ this -> setLogs ( 'Unable to open file for upload via SFTP.' , 'error' ) ; } return $ written ; }
Upload the current client file by sFTP.

@param $operation

@return bool
Upload the current client file by sFTP .