i have a code that reads from a directory and echose the directory out to the php web page.what it wont do is write to a file so that a music player or my other a video player can read from
this code is to write to the file
// directory path can be either absolute or relative
$dirPath = 'music/.';
$myFile = "music.m3u";
$stringData = "$file";
// open the specified directory and check if it's opened successfully
if ($handle = opendir($dirPath)) {
// keep reading the directory entries 'til the end
while (false !== ($file = readdir($handle)))
// just skip the reference to current and parent directory
if ($file != "." && $file != "..") {
if (is_dir("$dirPath/$file")) {
// found a directory, do something with it?
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $stringData);
fclose($fh);
}
}
// ALWAYS remember to close what you opened
closedir($handle);
}
?>
can anyone help thank you