| @@ 42-50 (lines=9) @@ | ||
| 39 | $this->sftp = $sftp; | |
| 40 | } | |
| 41 | ||
| 42 | public function copy($remoteFile, $localFile) | |
| 43 |     { | |
| 44 | $sftp = "ssh2.sftp://$this->sftp"; | |
| 45 | $data = file_get_contents($sftp . $remoteFile); | |
| 46 |         if (!$data) { | |
| 47 |             throw new \Exception('File can`t be loaded from server'); | |
| 48 | } | |
| 49 | file_put_contents($localFile, $data); | |
| 50 | } | |
| 51 | ||
| 52 | public function send($localFile, $remoteFile) | |
| 53 |     { | |
| @@ 52-59 (lines=8) @@ | ||
| 49 | file_put_contents($localFile, $data); | |
| 50 | } | |
| 51 | ||
| 52 | public function send($localFile, $remoteFile) | |
| 53 |     { | |
| 54 | $sftp = "ssh2.sftp://$this->sftp"; | |
| 55 | $data = file_get_contents($localFile); | |
| 56 |         if (!file_put_contents($sftp . $remoteFile, $data)) { | |
| 57 |             throw new \Exception('File could not be uploaded to server'); | |
| 58 | } | |
| 59 | } | |
| 60 | ||
| 61 |     public function getFilesList($dir) { | |
| 62 |         $handle = opendir("ssh2.sftp://$this->sftp" . $dir); | |