ftp_chdir
Change the current directory on the FTP server.
ftp_chdir()
function changes the current directory on the FTP server.
If successful, return true. Otherwise, return false. If the directory switch fails, PHP will also issue a warning.
<?php $conn = ftp_connect ( "ftp.testftp.com" ) or die ( "Could not connect" ) ; ftp_login ( $conn , "admin" , "ert456" ) ; //Output the current directory echo "Dir: " . ftp_pwd ( $conn ) ; echo "<br />" ; //Switch to images directory ftp_chdir ( $conn , "images" ) ; echo "Dir: " . ftp_pwd ( $conn ) ; ftp_close ( $ftp_server ) ; ?>
Output:
Dir: / Dir: /images
ftp_chdir ( ftp_connection , directory )
parameter | describe |
---|---|
ftp_connection | Required. Specifies the FTP connection to be used (the identifier of the FTP connection). |
Directory | Required. Specify the directory to switch to. |