passing dynamic variables to opendir

[php][/php]<?php
$dirname=$_POST[‘dir’];
$topath=$_POST[‘path’];
echo $dirname;

  $yourStartingPath = 'mp3';
   $iterator = new RecursiveIteratorIterator( 
        new RecursiveDirectoryIterator($yourStartingPath),  
    RecursiveIteratorIterator::SELF_FIRST); 

   foreach($iterator as $file) { 
     if($file->isDir()) { 
   $path = $file->getRealpath(); 
$path2 = PHP_EOL;
$path3 = $path.$path2;
 $res=explode('/', $path3);
$result = end($res); 
$dir= basename($result );

echo “”;
echo “”;
echo “”;
echo “”;}}
$dir1=“mp3”.$dirname;
echo $dirname;
//Open images directory
$dir = opendir("$dir1");

//List files in images directory
while ($dir&&($file = readdir($dir)) !== false)
{
if($dir&&!is_dir($file)){
echo "filename: " . $file . “
”;

}}

closedir($dir);

<? [php][/php]

Guys out there pls help me with this, it keeps on displaying the warning
Warning: opendir(mp3/abc ,mp3/abc ) [function.opendir]: The filename, directory name, or volume label syntax is incorrect. (code: 123) in C:\xampp\htdocs\player\test.php on line 26

folder structure is player> mp3>abc

Sponsor our Newsletter | Privacy Policy | Terms of Service