On 9/23/05, Emily McCall <[EMAIL PROTECTED]> wrote:
> I am trying to figure out whether php will help me to set up a website
> which is essentially just links to donwloadable material.
>
> I have directories in place and am using flash to auto fill the directory
> names on to an index page, however i cant use this to access the files
> themselves. So I am after a language i can use to read all the file names
> in the directory and display them with a bit of 'niceness' onto a webpage
> so as they can be used as links to the files.


Yeah, PHP can do that.  Toss this in a web directory and pull it up in
a browser.

<?php

$files = array();

$d = dir( './' );

while( false !== ( $entry = $d->read() ) )
{
    if( $entry != '.'
        && $entry != '..'
        && !is_dir( $entry ) )
    {
        $files[] = $entry;
    }
}

sort( $files );

foreach( $files as $file )
{

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

}

?>


--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

Reply via email to