Пример #1
0
 public function downloadFile($remotePath, $localPath)
 {
     // open the connection
     $this->openConnection();
     $pathInfo = pathinfo($remotePath);
     $pathToFile = $pathInfo['dirname'];
     $fileName = $pathInfo['basename'];
     $this->client->cd($pathToFile);
     // read the content of a remote file
     $fileContents = $this->client->read($fileName);
     // write the content to the local filesystem
     $result = $this->filesystem->write($localPath, $fileContents);
     // close the connection
     $this->closeConnection();
     if (!$result) {
         $message = $this->__(static::WRITE_FAILED_MESSAGE);
         throw new Ryaan_Ftp_Exception_WriteFailed($message);
     }
 }
Пример #2
0
 /**
  * @param string $fileName
  * @param string $content
  * @return bool
  */
 public function writeResultFile($fileName, $content)
 {
     $content = "<?php\n" . $content;
     return $this->_ioObject->write($fileName, $content);
 }