olympios Posted March 10, 2011 Share Posted March 10, 2011 Hello, folks. I am having a little trouble with this script. I want it to be able to read a directory, not just a file, and list all files in the directory along with their id3 tags. I can't get it to read all the files, it reads only the first file in the directory. Here, I'm posting the basic (stripped down) script, without mods or add-ons. I would appreciate any help. Thanks. <?php require('error.inc.php'); require('id3.class.php'); $nome_arq = 'music.mp3'; $myId3 = new ID3($nome_arq); if ($myId3->getInfo()){ echo('<HTML>'); echo('<a href= "'.$nome_arq.'">Click to play: </a><br>'); echo('<table border=1> <tr> <td><strong>Artist</strong></td> <td><strong>Title</strong></font></div></td> <td><strong>Track</strong></font></div></td> <td><strong>Album/Year</strong></font></div></td> <td><strong>Genre</strong></font></div></td> <td><strong>Comments</strong></font></div></td> </tr> <tr> <td>'. $myId3->getArtist() . ' </td> <td>'. $myId3->getTitle() . ' </td> <td>'. $myId3->getTrack() . ' </td> <td>'. $myId3->getAlbum() . '/'.$myId3->getYear().' </td> <td>'. $myId3->getGender() . ' </td> <td>'. $myId3->tags['COMM']. ' </td> </tr> </table>'); echo('</HTML>'); }else{ echo($errors[$myId3->last_error_num]); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/230196-php-directory-access/ Share on other sites More sharing options...
bh Posted March 10, 2011 Share Posted March 10, 2011 Hi, Glob With glob you can read only directiories, or files and directories, you can filter by names and has many more feature. Quote Link to comment https://forums.phpfreaks.com/topic/230196-php-directory-access/#findComment-1185528 Share on other sites More sharing options...
olympios Posted March 10, 2011 Author Share Posted March 10, 2011 Thanks Bh. I used glob but was able to just get a plain list of files. I can't make it to "cooperate" with with the rest of the code so to echo each file with it's respective id3 tags. It must be something very simple but my brain doesn't cooperate either! Quote Link to comment https://forums.phpfreaks.com/topic/230196-php-directory-access/#findComment-1185548 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.