Javatpoint Logo
Javatpoint Logo

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:

Parameter Description Is compulsory
ftp_connection/stream The link identifier of the FTP connection. compulsory
directory The 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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA