this php script scan mp3/a dir and creates xml file that reads flash and flash creats list of files and folders but it only wach(scan) mp3 files,but i want to scan any file tupe with this script how i can do this :)?
<?php
$dir = "mp3/a/";
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
";
echo "<music>
";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$subdir = $file;
if ($subdir != "." && $subdir != ".." && $subdir != "_notes") {
echo "<artist label=\"$subdir\" >
";
//Scan the subdirectories
if ($sh = opendir($dir . $subdir."/")) {
while (($sfile = readdir($sh)) !== false) {
if ($sfile != "." && $sfile != "..") {
$pos = strrpos($sfile, ".mp3");
if ($pos) {
$subfile = $sfile;
echo "<song url=\"$dir$subdir/$subfile\" label=\"" . str_replace(".mp3","",$subfile) . "\" />
";
}
}
}
closedir($sh);
}
echo "</artist>
";
}
}
closedir($dh);
}
}
echo "</music>"
?>