HTML listing of FTP contents?

Soldato
Joined
1 Jan 2007
Posts
3,186
Location
Exeter
Hi all,

Just a quick question. I've got an FTP directory containing a number of files. Does anyone know a way to automatically create a HTML page listing all the files with a link to each?

Ta,

MD
 
Code:
<?php
if( $hDir = opendir('.') )
{
    while( false !== ($file = readdir($hDir)) )
    {
        if( $file != "." && $file != ".." )
            echo nl2br( "$file\n" );
    }
}
closedir($hDir);
?>
 
steve-h, that is so beautiful!

Now I'm curious, can they be automatically made into hyperlinks?

Code:
<?php
if( $hDir = opendir('.') )
{
    while( false !== ($file = readdir($hDir)) )
    {
        if( $file != "." && $file != ".." )
            echo nl2br( "<a href=\"$file\">$file</a>\n" );
    }
}
closedir($hDir);
?>

:D
 
Back
Top Bottom