Get filename extension
Posted on July 15, 2008, under PHP,
Bookmark it
This snippet can help you to get the extension of a filename:
<?php ... some code here ... // Filename $filename = 'public_html/root/internet.gif'; // Extension $ext = strrchr($filename, "."); echo $ext; // will return ".gif" ?>
Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!
- July 15, 2008
- article by Gabriel C.
- 1 comment
Related Posts
-
How to remove an extension from a filenameat September 4, 2008 with 1 comment
-
PHP: Get filename of the currently executing scriptat May 21, 2008
-
Create, Customize and Send Newsletters: MeeNewsat August 3, 2009 with 3 comments
-
How to make a PHP download script without disclosing the location of the filesat September 20, 2008 with 5 comments
-
PHP: How to Create Mirror Images using GDat January 19, 2009 with 2 comments

One Reply to "Get filename extension"
June 1, 2010 at 8:03 PM
I think,
It will create a problem when the file name is like “xyx.02.jpg”