I did that months ago... I don´t remember well what I did, but I think I used a function named BASENAME
EX:
$file = "C:\dir\file.exe";
$only_file = basename($file);
$only_file will be set to "file.exe"
This function have another parameter suffix, if you want to have the suffix off, like this:
$file = "C:\dir\file.exe";
$only_file = basename($file, ".exe");
$only_file will be set to "file"
Return me if this works.