User Contributed Notes 2 notes

<?phpfunction ftp_is_dir( $dir ) { global $ftpcon;// get current directory$original_directory = ftp_pwd( $ftpcon );// test if you can change directory to $dir // suppress errors in case $dir is not a file or not a directoryif ( @ftp_chdir( $ftpcon, $dir ) ) {// If it is a directory, then change the directory back to the original directoryftp_chdir( $ftpcon, $original_directory ); return true; } else { return false; } } ?>