Developer Forums | About Us | Site Map
Search  
HOME > PHPMANUAL


Sponsors





Web Host
site hosted by netplex
Partners

Online Manuals

ftp_nlist

(PHP 3>= 3.0.13, PHP 4 )

ftp_nlist -- Returns a list of files in the given directory

Description

array ftp_nlist ( resource ftp_stream, string directory)

Returns an array of filenames from the specified directory on success or FALSE on error.

Example 1. ftp_nlist() example

<?php

// set up basic connection
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
    die("FTP connection has failed !");
}

// get contents of the root directory
$contents = ftp_nlist($conn_id, "/");

// print each entry
foreach ($contents as $entry) {
    echo $entry, "<br />\n";
}

 ?>

See also ftp_rawlist().

Copyright 2004-2017 GrindingGears.com. All rights reserved. Site hosted by NETPLEX