|
Posted by Bill Ray on 03/31/06 06:46
Heya all
I have a script that allows my website to display the contents of a
folder as links. I want those links to open as their MIME type (MP3
files) in a small window, displaying that file's name as an H2 tag.
Can someone help me out? Here's the script that I have:
$imagepath="/media/mp3s/new_tunes";
$realpath=$_SERVER['DOCUMENT_ROOT']."$imagepath";
$n=0;
$list=array();
if ($dir = @opendir($realpath)) {
while (($file = readdir($dir)) !== false) {
if(is_file("$realpath/$file") && ($file!=".htaccess")){
$n++;
$list[]=$file;
}
}
closedir($dir);
natcasesort($list);
echo "<p>$n Files:</p>\n";
echo "<ul>\n";
for ($i=0;$i<count($list);$i++){
$x=$i+1;
echo "<li>";
echo "<a href=\"$imagepath/$list[$i]\">$list[$i]</a>";
echo "</li>\n";
}
echo "</ul>";
}
Any help would be mucho appreciated!
~B
Navigation:
[Reply to this message]
|