Listing contents of a directory

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
Galahad
Forum Contributor
Posts: 111
Joined: Fri Jun 14, 2002 5:50 pm

Listing contents of a directory

Post 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?
User avatar
haagen
Forum Commoner
Posts: 79
Joined: Thu Jul 11, 2002 3:57 pm
Location: Sweden, Lund

Post 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 .
Post Reply