tags:

views:

98

answers:

1

Hello all,

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.

+2  A: 

You want to use

echo realpath($font_path . DIRECTORY_SEPARATOR . $file);

else it will look in the current working dir.

johannes
Awesome, thank you very much! That worked.
Abs