Page 1 of 1

Listing contents of a directory

Posted: Tue Jul 09, 2002 12:54 pm
by Galahad
I'm trying to make a form select where you can choose between the files in a directory. On an earlier version, I used opendir, etc because this script ran on the same server as the files. It worked great. Now I've had to move the script to a different server. I believe that opendir won't work on a www directory. I could open an FTP connection and read the files, but is there a better way to do it?

Posted: Thu Jul 11, 2002 4:07 pm
by haagen
You can probably reuse your old script. Put it onto the second webserver (with the files) and let it generate output in a nice way (one file per line). Then you open your script (on the second webserver) from the first server. You can use fopen to open a file on another webserver.

I haven't used the php ftp-functionallity. But I assume it isn't very hard to manage .