Jump to content

Recommended Posts

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() . '&nbsp</td>
                  <td>'. $myId3->getTitle()  . '&nbsp</td>
                  <td>'. $myId3->getTrack()  . '&nbsp</td>
                  <td>'. $myId3->getAlbum()  . '/'.$myId3->getYear().'&nbsp</td>
                  <td>'. $myId3->getGender() . '&nbsp</td>
                  <td>'. $myId3->tags['COMM']. '&nbsp</td>
               </tr>
            </table>');
         echo('</HTML>');
   	}else{
    	echo($errors[$myId3->last_error_num]);
   }
?>

Link to comment
https://forums.phpfreaks.com/topic/230196-php-directory-access/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.