Why does readdir() read the filename in string till space???
Posted: Wed Aug 06, 2008 3:35 am
I have the following code:
$dir="video";
$dh = opendir($dir);
while($file = readdir($dh)){
if ($file!="." && $file!=".."){
echo "<li><a href=list_video.php?dir=$file>$file</a></li><br>";
}
}
It works very well , but if the filename contains spaces within it (example: "tra la la") then the function reads the only a part of the filename , untill it encounters the first space (example: $file = "tra" if it were to be "tra la la".
Are there any solutions to read the whole filename even if it has spaces within it?
Thank You
$dir="video";
$dh = opendir($dir);
while($file = readdir($dh)){
if ($file!="." && $file!=".."){
echo "<li><a href=list_video.php?dir=$file>$file</a></li><br>";
}
}
It works very well , but if the filename contains spaces within it (example: "tra la la") then the function reads the only a part of the filename , untill it encounters the first space (example: $file = "tra" if it were to be "tra la la".
Are there any solutions to read the whole filename even if it has spaces within it?
Thank You