prob while listing contents

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
phpcoder
Forum Contributor
Posts: 158
Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK

prob while listing contents

Post by phpcoder »

Hi ,
I have some prob in using ftp_nlist function when i called this function it only displays the files in specified folder not the directories . i want to display the entire contents of the dir including files and directories .
plz help
thanks
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Try something like:

Code: Select all

if ($open = opendir('directoryname'))
{
 while(false != ($file = readdir($open)))
 {
  print($file."\n");
 }
 closedir($open);
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[php_man]glob[/php_man]() may also work, depending on your php version... :)
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Yeah I think phpcoder wishes for everything to be shown but glob() uses pattern matches. :D
User avatar
phpcoder
Forum Contributor
Posts: 158
Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK

Post by phpcoder »

feyd wrote:[php_man]glob[/php_man]() may also work, depending on your php version... :)
I want to display user wid all contents of his home directory after successfull loging . It is basically a ftp facility thro browser where tjhe user can upload files rename delete etc the file in his home directory . The prob dat m facing is dat i m using ftp_nlist() it displays file but not the directories . i don no was the prob plz help me . M stuck in
M using PHP5
Post Reply