• Welcome to Simple Machines Community Forum. Please login or sign up.



Changes to the specified directory, if possible.


bool ftp_connection::chdir (string $ftp_path)

Parameter $ftp_path

Expected type: String
Description: The path to a directory

Return value

Expected type: Boolean
Description: True if the command was successful, false otherwise


  • Example: $package_ftp->chdir('/path/to/some/directory');
  • Sends the CWD (Change Working Directory) command to the FTP server
  • Checks to make sure there's a valid connection before continuing
  • Checks for a response code of 250 (Requested file action ok, completed)
  • Sets a "bad_path" error if the command wasn't successful
  • Returns false if there's no connection or the command wasn't successful