Reputation: 3797
I'm using the following PHP snippett to display all the pdf in a directory. How do I alter this code to still specify the directory BUT only display the filename?
foreach (glob("directory/sub-directory/sub-subdirectory/*.pdf") as $filename) {
echo "$filename <BR>\n";
}
Upvotes: 2
Views: 1449
Reputation: 12601
How about this:
$shortname = basename($filename);
echo "$shortname <BR />\n";
You would be making use of the basename function.
Upvotes: 4