PHP ftp_chdir() Function

The ftp_chdir() function is used to change the current directory to a specified directory on an FTP server. This function was introduced in PHP 4.

Syntax:

ParameterDescriptionIs compulsory
ftp_connection/streamThe link identifier of the FTP connection.compulsory
directoryThe target directory.compulsory

Returns

This method returns TRUE on success or FALSE on failure.

Example 1

Explanation

If the directory is changed, it echo can change the current directory. If not changed, it echo couldn't change directory. By using ftp_chdir( ) function, we can able to change the directory.

Example 2

In the above program, the directory is changed by using ftp_chdir( ) function. If the directory is changed, it prints chdir not successful.


Next TopicPHP FTP




Latest Courses