public function chdir($dir) { if (!ftp_chdir($this->conn, $dir)) { throw new Exception('Error: There was an error changing to the directory ' . $dir); } return $this; }