WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP ftp_nlist () function


Definition and usage

ftp_nlist () Function returns a list of files in the specified directory on the FTP server.

If successful, returns an array of file names in the specified directory. If it fails, it returns FALSE.

Syntax

ftp_nlist (ftp_connection, dir)

parameters description
ftp_connection Required. Specifies the FTP connection to use.
dir Required. Specifies the directory to check. Please use "." To get the current directory.


Tips and comments

Note: This function is not available for IIS (Internet Information Server). It returns nothing.


Example

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

print_r(ftp_nlist($conn,"images"));

ftp_close($conn);
?>

The above code will output:

array(3)
{
[0]=> "flower.gif"
[1]=> "car.gif"
[2]=> "house.gif"
}