Net_FTP::cd() – changes the directory on the server.


require_once 'Net/FTP.php';

mixed Net_FTP::cd ( string $directory )


Changes the directory on the FTP server you are logged in. The parameter can either be an absolute path (e.g. '/home/mydir') or a relative one (e.g. 'mydir').


  • string $directory - The directory you want to change to. This can either be an absolute path (e.g. '/home/mydir') or a relative one (e.g. 'mydir').

Return value

mixed - true on success, otherwise PEAR::Error.


The returned PEAR_Error object in case of an error is unspecific. You can ignore the errornumber and errormessage, because only "Directory change failed" will be returned if the operation fails.


This function can not be called statically.


Using cd()


logs into the FTP server you are connected to (Previous) returns the directory on the server you are currently in. (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.