WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Php ftp_chdir () function


Definition and usage

ftp_chdir () Function changes the current directory on the FTP server to the specified directory.

If successful, the function returns TRUE. If it fails, FALSE and a warning are returned.

Syntax

ftp_chdir (ftp_connection, directory)

parameters description
ftp_connection Required. Specifies the FTP connection to use.
directory Required. Specifies the directory to switch to.


Example

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");

//Outputs the current directory
echo "Dir: ".ftp_pwd($conn);
echo "<br />";
//Change to the images directory
ftp_chdir($conn,"images");
echo "Dir: ".ftp_pwd($conn);

ftp_close($ftp_server);
?>

The above code will output:

Dir: /
Dir: /images