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 />";
                          }
                        }
 ?>

[EMAIL PROTECTED] 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
[EMAIL PROTECTED]
760.753.6766
########################




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to