Your problem is using glob() - which species that it return an array of file names. And that's all.
You need to get the file list by using the
php File System functions[
^] You can use this to get file list and properties for the files.
There's an lot of stuff you should learn about so you can handle files efficiently and, in the long term, much more easily.