On Friday 02 August 2002 02:53, [EMAIL PROTECTED] wrote:
> 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. 

> 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);
> }
> ?>

1) If you don't want the parent directory (..) and current directory (.) to 
appear you should follow the example(s) in the manual.

2) In your while loop you can do something like:

   while (false !== ($file = readdir($handle))) {
     $file_array[] = $file;
   }

This will put all your files into an array $file_array, which you can then use 
foreach() to loop through each item and display neatly.

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

These are basic HTML issues which presumably you should know the answer to.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Alimony is the high cost of leaving.
*/


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

Reply via email to