Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $this->connID = ftp_connect($this->host, 21, static::FTP_TIMEOUT);
- if (!$this->connID) {
- throw new Exception('Connection to FTP: '. $this->host .' failed.');
- }
- $loginResult = ftp_login($this->connID, $this->username, $this->password);
- if(!$loginResult) {
- throw new Exception('Auth for FTP user ' .$this->username. ' failed.');
- }
- $resultPwd = ftp_pwd($this->connID);
- if ($resultPwd===false) {
- throw new Exception ('Command ftp_pwd failed.');
- }
- $resultChdir = ftp_chdir($this->connID, $this->filesDir);
- if ($resultChdir===false) {
- throw new Exception ('ftp_chdir failed, its most likely that directory: ' .$this->filesDir . ' does not exists');
- }
- $resultChdirBack = ftp_chdir($this->connID, $resultPwd);
- if ($resultChdirBack===false) {
- throw new Exception ('Directory test failed, coult not set back directory to: '. $resultChdirBack);
- }
- $arrFilePath= ftp_nlist($this->connID, $this->filesDir);
- $resultGet = ftp_fget($this->connID, $fhTemp, $remoteFilePath, FTP_ASCII);
- Warning: ftp_fget(): Server cannot accept argument.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement