Welcome to CodeRanch!
First of all, you don't want to be mixing presentation and business logic. Use a template language to create the pages where you display the file names.
When you've created your template, you can render a view by passing it the data that needs to be displayed by the template. Pass it the array of file names, and let the template render them in a for-loop.
In your business logic, if you have an array of file paths, you can convert the array to a different array that contains only the file names. Use the array_map() function for this: