Reputation: 57916
I have the following which just loops through the files in a directory and echo the file names. However, when I use realpath, it returns nothing. What am I doing wrong:
if ($handle = opendir($font_path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "a.zip") {
echo $file.'<br />';//i can see file names fine
echo realpath($file);// return empty string?!
}
}
closedir($handle);
}
Thanks all for any help on this.
~I am on a windows machine, running php 5.3 and apache 2.2.
Upvotes: 0
Views: 2365
Reputation: 15969
You want to use
echo realpath($font_path . DIRECTORY_SEPARATOR . $file);
else it will look in the current working dir.
Upvotes: 3