What do you need it for. Depending on the application, you probably will not even need to know it. I know RGSS does not require the extension when loading files from the Cache, etc.
If that is not your problem, the simplest way to do it that I know would be to create a RegExp to look for the pattern of the file type you are searching for from the file's name.