By looking at the posted code, Very likely the filename in the directory and download_manager table are mismatch.
Example:
let say this is download_manager table
Filename Downloads
abc 10
xyz.txt 20
let say these are the files in the directory
Directory
abc.txt
xyz.doc
based on the code
$fileInfo["abc.txt"] --> Undefined index error
$fileInfo["xyz.doc"] --> Undefined index error