Re: Php Dynamic Pages & Apache Server
| From: | Lee | Date: | Thu, 01 Aug 2002 17:14:45 +0000 |
| Subject: | Re: Php Dynamic Pages & Apache Server | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110708@lists.php.net to get a copy of this message | ||
You could try using the readdir function to read a list of files (full docs
available from http://www.php.net/manual/en/function.readdir.php)
Here is an expanded version of the example give on the above link.
<html>
<body>
File List
<?php
if ($handle = opendir('./)) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
echo "<a href='$file'>$file</a><br>";
}
closedir($handle);
}
?>
</body>
</html>
This example assumes that the PHP script and files are in the same directory
and are all publically accessible (i.e. a user could simple type
http://www.example.com/filename)
Hope this helps
Regards
Lee
----- Original Message -----
From: <msmecca@mindspring.com>
To: <php-general@lists.php.net>
Sent: Thursday, August 01, 2002 5:57 PM
Subject: [PHP] Php Dynamic Pages & Apache Server
> I am trying to create a php page that will show the files on an apache
server.
> Each file will show up as a link on the page. When clicked, the user will
be
> able to download the file. Is there anyone out there that can lead me in
the
> right direction.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>