- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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_nlist() function in PHP
The ftp_nlist() function returns a list of files in the specified directory on the FTP server.
Syntax
ftp_nlist(con,dir);
Parameters
con − The FTP connection
dir − The directory to be listed
Return
The ftp_nlist() function returns an array of file names on success or FALSE on failure.
Example
The following is an example wherein we are getting the list of files in the current directory −
<?php $ftp_server = "192.168.0.4"; $ftp_user = "tim"; $ftp_pass = "wthbn#@121"; $con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server"); $login = ftp_login($con, $ftp_user, $ftp_pass); $list = ftp_nlist($con, "."); var_dump($list); // close ftp_close($con); ?>
Advertisements