by Hiroshi on August 7th, 2008

This single file script will display all mp3 music files from directory and display song names and file size while you can play song by a link too. Just place this script in directory containing mp3 music files and browse script by local or online server.
<table ALIGN=CENTER BGCOLOR=#ffffff CELLPADDING=4 CELLSPACING=0 BORDER=2> <tr><th>File</th><th>Size</th></tr>
<?php $dir="./"; if (is_dir($dir)) { $fd = @opendir($dir); while (($part = @readdir($fd)) == true) { if ($part != "." && $part != "..") { $file_array[]=$part; } } if ($fd == true) { closedir($fd); } } sort($file_array); reset($file_array); for($i=0;$i<count($file_array);$i++) { $npart=$file_array[$i]; if (strstr($npart,".mp3")) { $name=str_replace(".mp3","",$npart); $fsize=filesize($npart)/1000; print("<tr><td><a href=\"$npart\">$name</a>"); print("<td>$fsize</td></tr>"); } } ?>
</table>



Incoming Searches