Page 1 of 1

prob while listing contents

Posted: Sat Aug 07, 2004 7:02 am
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

Posted: Sat Aug 07, 2004 9:39 am
by Joe
Try something like:

Code: Select all

if ($open = opendir('directoryname'))
{
 while(false != ($file = readdir($open)))
 {
  print($file."\n");
 }
 closedir($open);

Posted: Sat Aug 07, 2004 11:36 am
by feyd
[php_man]glob[/php_man]() may also work, depending on your php version... :)

Posted: Sat Aug 07, 2004 11:48 am
by Joe
Yeah I think phpcoder wishes for everything to be shown but glob() uses pattern matches. :D

Posted: Sun Aug 08, 2004 2:30 am
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