Question: At the moment I can list all the files in a directory. I am using this code and it works fine:

```
 <?php

    if ($handle = opendir('./uploaded')) {

        while (false !== ($entry = readdir($handle))) {

            if ($entry != "." && $entry != "..") {
                echo '<div class="col-md-3"><div class="panel panel-default"><!-- Default panel contents --><div class="panel-heading">'.$entry.'</div><div class="panel-body">'.$entry.'</div><div class="panel-footer"><a href="./uploaded/'.$entry.'">View File</a></div></div></div>';
            }
        }

    closedir($handle);

    }

?>

```

Now I want to display all the information about the file in the while section. I have seen people do this using similar techniques with C and other languages.

Answer: 
Try [fstat](http://php.net/manual/en/function.fstat.php) for more details 

Description ¶

```
array fstat ( resource $handle )

```

Gathers the statistics of the file opened by the file pointer handle. This function is similar to the `stat()` function except that it operates on an open file pointer instead of a filename.

```
<?php

// open a file
$fp = fopen("/etc/passwd", "r");

// gather statistics
$fstat = fstat($fp);

// close the file
fclose($fp);

// print only the associative part
print_r(array_slice($fstat, 13));

?>

```

Output :

```
Array
(
    [dev] => 771
    [ino] => 488704
    [mode] => 33188
    [nlink] => 1
    [uid] => 0
    [gid] => 0
    [rdev] => 0
    [size] => 1114
    [atime] => 1061067181
    [mtime] => 1056136526
    [ctime] => 1056136526
    [blksize] => 4096
    [blocks] => 8
)

```
Try Like this..

```
<?php
     if ($handle = opendir('./uploaded')) {
       while (false !== ($entry = readdir($handle))) {
         if ($entry != "." && $entry != "..") {
          echo '<div class="col-md-3"><div class="panel panel-default"><!-- Default panel contents --><div class="panel-heading">'.$entry.'</div><div class="panel-body">'.$entry.'</div><div class="panel-footer"><a href="./uploaded/'.$entry.'">View File</a></div></div></div>';
          echo $entry . ': ' . filesize($entry) . ' bytes'; // Gets file size e.g. xyz.txt: 1024 bytes
         }
       }
       closedir($handle);
     }
?>

```