The ftp_nlist() function returns the file list in the specified directory on the FTP server.
If successful, an array of file names in the specified directory is returned. If it fails, returns FALSE.
ftp_nlist(ftp_connection,dir)
parameter | describe |
---|---|
ftp_connection | Required. Specifies the FTP connection to use. |
dir | Required. Specifies the directories to be checked. Please use "." to get the current directory. |
Note: This function does not apply to IIS (Internet Information Server). It returns nothing.
<?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"}