sapnawat Posted July 26, 2020 Share Posted July 26, 2020 (edited) Inside one folder i have around 200 folder's and each folder's having 150 mp3 files. I want to get metadata of each mp3 file's below is the code which i have tried but getting below error. Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(C:\Users\Desktop\Rajesh song,C:\Users\Desktop\Rajesh song): The system cannot find the path specified. (code: 3)' in C:\xampp\htdocs\getID3-master\rajupal.php:4 Stack trace: #0 C:\xampp\htdocs\getID3-master\rajupal.php(4): RecursiveDirectoryIterator->__construct('C:\\Users\\Deskto...') #1 {main} thrown in C:\xampp\htdocs\getID3-master\rajupal.php on line 4 <?php include("getid3/getid3.php"); $directory = 'C:\Users\Desktop\Rajesh song'; $filename = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); while($filename->valid()) { if (!$filename->isDot()) { $getID3 = new getID3; $file = $getID3->analyze($filename); //print_r($file); $playtime_seconds = $file['playtime_seconds']; $dumpa=gmdate("H:i:s", $playtime_seconds); $filesize = $file['filesize']; $filepath = $file['filepath']; $filename = $file['filename']; $filename1 = $file['fileformat']; echo "<table class='table table-striped'>"; echo "<tr>"; echo "<th>File Path</th>"; echo "<th>Name</th>"; echo "<th>Size(kb)</th>"; echo "<th>Duration</th>"; echo "<th>File Type</th>"; echo "</tr>"; echo "<tr>"; echo "<td> ".$filepath."</td>"; echo "<td> ".$filename."</td>"; echo "<td> ".$filesize."</td>"; echo "<td> ".$dumpa."</td>"; echo "<td> ".$filename1."</td>"; echo "</tr>"; echo "</table>"; } $filename->next(); } ?> Edited July 26, 2020 by sapnawat Quote Link to comment https://forums.phpfreaks.com/topic/311223-php-code-to-get-metadata-from-folder-having-mp3-files/ Share on other sites More sharing options...
gw1500se Posted July 26, 2020 Share Posted July 26, 2020 The message is clear. The path is wrong. You probably want: $directory = "C:\Users\%username%\Desktop\Rajesh song"; Quote Link to comment https://forums.phpfreaks.com/topic/311223-php-code-to-get-metadata-from-folder-having-mp3-files/#findComment-1580103 Share on other sites More sharing options...
sapnawat Posted July 26, 2020 Author Share Posted July 26, 2020 Hi gw1500se, Thanks for the reply. I have change path to $directory = "C:\Users\%username%\Desktop\Rajesh song"; but still getting error. Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(C:\Users\%username%\Desktop\Rajesh song,C:\Users\%username%\Desktop\Rajesh song): The system cannot find the path specified. (code: 3)' in C:\xampp\htdocs\getID3-master\rajupal.php:4 Stack trace: #0 C:\xampp\htdocs\getID3-master\rajupal.php(4): RecursiveDirectoryIterator->__construct('C:\\Users\\%usern...') #1 {main} thrown in C:\xampp\htdocs\getID3-master\rajupal.php on line 4 Quote Link to comment https://forums.phpfreaks.com/topic/311223-php-code-to-get-metadata-from-folder-having-mp3-files/#findComment-1580109 Share on other sites More sharing options...
gw1500se Posted July 26, 2020 Share Posted July 26, 2020 I don't know where that directory is, you do. I only know the path you had originally did not make sense so I made a suggestion. You have to provide the correct path. Quote Link to comment https://forums.phpfreaks.com/topic/311223-php-code-to-get-metadata-from-folder-having-mp3-files/#findComment-1580111 Share on other sites More sharing options...
sapnawat Posted July 26, 2020 Author Share Posted July 26, 2020 (edited) sure! The correct path of file is C:\Users\r.shishodia\Desktop\Rajesh song. Rajesh song is folder name having two mp3 files. Edited July 26, 2020 by sapnawat Quote Link to comment https://forums.phpfreaks.com/topic/311223-php-code-to-get-metadata-from-folder-having-mp3-files/#findComment-1580112 Share on other sites More sharing options...
gw1500se Posted July 26, 2020 Share Posted July 26, 2020 OK, use that. Quote Link to comment https://forums.phpfreaks.com/topic/311223-php-code-to-get-metadata-from-folder-having-mp3-files/#findComment-1580121 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.