The ftp_chdir() function changes the current directory on the FTP server to the specified directory.
If successful, the function returns TRUE. On failure, returns FALSE and a warning.
ftp_chdir(ftp_connection,directory)
parameter | describe |
---|---|
ftp_connection | Required. Specifies the FTP connection to use. |
directory | Required. Specifies the directory to switch to. |
<?php$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");ftp_login($conn,"admin","ert456");//Outputs the current directoryecho "Dir: " .ftp_pwd($conn);echo "<br />";//Change to the images directoryftp_chdir($conn,"images");echo "Dir: ".ftp_pwd($conn);ftp_close($ftp_server);?>
The above code will output:
Dir: /Dir: /images