I tried 100 ways to get the file extension from a complete file path including directories and file name with extension. This one works perfectly. This uses php function pathinfo to get the directory name, filename and its extension for you which is very handy.

when you rate a post here. Its an Ajax script working on the background showing you the nice status bar message with this icon. Its interactive and a good usable thing for your own Ajax script. Wanna make one like that for your ajax stuff? Yeah you can do so on the web!