If you can be certain that the extensions to the files are valid (for instance, .htm files are indeed HTML files, .gif files are indeed GIF files etc)..then you could use the following not-the-best-but-simple solution.
Take the "basename()" of the file, and then get the letters AFTER the "." on the file.
For instance, if the filename is "mysoftware.exe", then get the "exe" after the dot.
I think you could use something like this:
$myFileName = basename(somepath);
$myFileExtension = substr($myFileName, strpos("."));
Let me know if this works, I havent tried it..
Shanx