Q:

PHP fsize - possible reasons for failure?

I've got a question I can see being asked all around the internet but I haven't seen an answer that would help me.
Long story short; I've got a PHP script that lists files in a directory (file name, ctime). Both file name & creation date work fine, but I'm struggling with file-size. 
This is the code that lists the files in a specific folder:
    

    //show only files with 'xml' extension
    if ($files[$b] != "." && $files[$b] != ".." && $ext == 'xml') {
        echo "<tr style=\"border: 1px solid gray; background-color:";
        if ($even) {
            echo "#fff5cc;\">";
        } else {
            echo "white;\">";
        }
        echo "<td>$files[$b]";
        echo "(" . filesize($files[$b]) . ")";
        //echo filesize($files[$b]);
        echo "</td>";
        echo "<td>" . date("F d Y H:i:s.", filectime(UPLOAD_FOLDER . "/" . $files[$b]))     . "</td>";

    }
    $even = !$even;
}
?>

Key stuff happens in the line code that shows the filesize; PHP error is 'Stat Failed...'. I have to admit I have no idea why because I'm able to open the file (one of the functions actually opens the XML file and places its contents to a text-area).
As most answers are about permissions, I actually tried adding 777 permissions to a test file and 777 to the folder where the file is saved, but to no avail. Thanks in advance!

A:

I believe you have forgotten to link full path to the file. Have a look what do you few lines below:
filectime(UPLOAD_FOLDER . "/" . $files[$b])

So, the same should go everywhere:
filesize(UPLOAD_FOLDER . "/" . $files[$b])

Commentts below:
Also, I suppose $b is an iterator. If it is, you don't need $even variable, because you can use modulo operator:
if($b%2==0)
  //event

Using other variable is not problem here, however it's good to be aware of other possible solutions.
I'd also let you know that there's a glob function. You could use it to get the XML file list:
$list = glob(UPLOAD_FOLDER . "/*.xml");

