Re: Php Dynamic Pages & Apache Server
| From: | Nicole Lallande | Date: | Thu, 01 Aug 2002 17:06:45 +0000 |
| Subject: | Re: Php Dynamic Pages & Apache Server | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110709@lists.php.net to get a copy of this message | ||
This will read all '.pdf' files in a sub-directory and put them in a link -
HTH,
Nicole
<?php // read the contents of this directory
$dir = ('./accessories/');
$dir_stream = @ opendir($dir)
or die ("Could not open a directory stream for <i>$dir</i>.");
while($entry = readdir($dir_stream)) {
// get the file extention
$ext = substr($entry, strrpos($entry,'.'));
// print the link to the file
if ($ext == '.pdf') {
echo "<a href='$entry'>$entry</a><br />";
}
}
?>
msmecca@mindspring.com wrote:
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.-- ######################## Nicole Lallande nicole@nmlconsulting.com 760.753.6766 ########################