This code will work if I run it on my apache server I run from home for testing, but as soon as I host it dies, only echoes 'filelist=' and can't read any of the files in the directory, if I get rid of gallery it will read the root directory but thats it. anyone have any clue? I hope I explained this well.
<?php
$PATH = $_ENV['DOCUMENT_ROOT'];
$d=$PATH.'/gallery/'; #define which dir you want to read
//$files = array(); #initialize array
$files = '';
$dir = opendir($d); #open directory
while ($f = readdir($dir)) { #read one file name
//if (eregi("/.mp3",$f)){ #if filename matches .txt in the name
if (!eregi(".mp3",$f) && $f!=='.' && $f!=='..'){ #if does not match .jpg . and ..
if ($files == ""){
$files = $f;
}else{
$files = $files . ',' . $f;
}
//array_push($files,"$f"); #push into $files array
//echo "filelist=$files"; #print name of each file found
}
}
echo "filelist=$files"; #print name of each file found
?>