 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_chdir() function in PHP
The ftp_chdir() function changes the current directory on the FTP server.
Syntax
ftp_chdir(con, dir)
Parameters
- con − The FTP connection 
- dir − The directory to change to 
Return
The ftp_chdir() function returns TRUE on success or FALSE on failure.
Example
The following is an example wherein the current directory is changed −
<?php    $ftp_server="ftp.example.com";    $ftp_user="kevin";    $ftp_pass="tywg61gh";    $con = ftp_connect($ftp_server);    $res = ftp_login($con, $ftp_user, $ftp_pass);    ftp_chdir($con, 'demo');    echo ftp_pwd($con); /    if (ftp_cdup($con)) {       echo "Directory changed!
";    } else {       echo "Directory change not successful!
";    }    echo ftp_pwd($con);    ftp_close($con); ?>Advertisements
 