Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. $this->connID = ftp_connect($this->host, 21, static::FTP_TIMEOUT);
  2. if (!$this->connID) {
  3. throw new Exception('Connection to FTP: '. $this->host .' failed.');
  4. }
  5.  
  6. $loginResult = ftp_login($this->connID, $this->username, $this->password);
  7. if(!$loginResult) {
  8. throw new Exception('Auth for FTP user ' .$this->username. ' failed.');
  9. }
  10.  
  11. $resultPwd = ftp_pwd($this->connID);
  12. if ($resultPwd===false) {
  13. throw new Exception ('Command ftp_pwd failed.');
  14. }
  15.  
  16. $resultChdir = ftp_chdir($this->connID, $this->filesDir);
  17. if ($resultChdir===false) {
  18. throw new Exception ('ftp_chdir failed, its most likely that directory: ' .$this->filesDir . ' does not exists');
  19. }
  20.  
  21. $resultChdirBack = ftp_chdir($this->connID, $resultPwd);
  22. if ($resultChdirBack===false) {
  23. throw new Exception ('Directory test failed, coult not set back directory to: '. $resultChdirBack);
  24. }
  25.  
  26. $arrFilePath= ftp_nlist($this->connID, $this->filesDir);
  27.  
  28. $resultGet = ftp_fget($this->connID, $fhTemp, $remoteFilePath, FTP_ASCII);
  29.  
  30. Warning: ftp_fget(): Server cannot accept argument.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement