[thelist] PHP help: ftp_nlist doesn't see directories?

Ben Phillips ben at inchima.com
Thu May 2 05:33:01 CDT 2002


> Basically, it's using ftp_nlist to get a list of files in the
> current directory and presenting them in a PHP loop.  If it's
> a directory, the original coder apparently thought that
> ftp_size would return -1 -- but no!  I've dumped the array
> that ftp_nlist returns, and there are no directories in it,
> only plain files.

it depends on the ftp server you are using, some servers won't return
the directory when you use nlist. have a look at
<http://bugs.php.net/?id=10977> for bug information.

you need ftp_rawlist <http://php.net/ftp_rawlist> and then you can parse
the stream it returns. there is some sample code on that page that will
help you.

not the best answer, but i hope it gets you on the right track.

benji
inchima.com.






More information about the thelist mailing list