Hello,
I was wondering if you could help me with the following file, and help me how to fix my error.
<?php
$directory='./music/';
$extension='';
$files_array = array();
$dir_handle = @opendir($directory) or die("There is an error with your file directory!");
while ($file = readdir($dir_handle))
{
if($file{0}=='.') {continue;}
if($extension == 'php'){ continue;}
if($extension == 'htaccess') {continue;}
$files_array[]=$file;
}
$file_downloads=sort($files_array,SORT_STRING);
$path_parts = pathinfo('musicogg');
foreach ($files_array as $file_name){
//echo "{mp3:\"music/$file_name.mp3\"}";
echo $path_parts['extension'], "\n";
}
?>
(removed spaces to compress it).
Anyhow, the last few lines of code, where I've commented a line of code out - that's working as it should by going into the dir and checking all the files and echo'ing them. So this is what I want.
I want it the final code to do this execute this line of code. {mp3:"music/name.mp3",ogg:"music/name.ogg"} - Notice, I do not really care if they the files need to be in one dir, or two dirs.
How would I do, so it would show that in HTML, of course with all the files in the dir(s). (Note, name.mp3 & name.ogg is the same song).
Thanks a ton