> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, August 01, 2002 2:54 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Readdir
> 
> New To Php so please bear with me... :)
> 
> I used the readdir function to read the files listed on a 
> Apache server. And
> it worked fine. Now I would like to be able to get the files 
> the php code
> returns, to be links. Where the user can click the file and 
> download it. Also
> for the files to sit within a table or at least look neat on the page.
> http://www.optimus7.com/findme.php is the result I get from 
> the php code
> below. Help!
> 
> <?php
> if ($handle = opendir('/my/directory')) {
>     echo "Directory handle: $handle\n";
>     echo "Files:\n";
> 
> 
> 
>     while (false !== ($file = readdir($handle))) { 
>         echo "$file\n";
>     }
> 
>   
>     closedir($handle); 
> }
> ?>

Change your echo stmt to something like:

echo "<a href=\"$file\">$file</a><br>\n";

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

Reply via email to