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.


3 Comments
Not everybody familier with php,

so write post title like,
Php-Tutorial-Get file extentions
or
how to get file extension through php code
I hope I don’t offend you.
Thanks for the suggestion.
Great !
Another similar resource of fileinfo : http://phpchunk.net/2011/06/the-best-way-to-get-a-file-extension/