PHP Get File Extension From A String

July 23rd, 2012 by Laeeq | 3 comments

During file upload, we often needs file extension to validate file. Here in this post I have written a PHP function that will get the file extension from string.

PHP Example Function:

  1. function getFileExtension($file_name)
  2. {
  3. return substr(strrchr($file_name,‘.’),1);
  4. }

 

You can subscribe to PHPZAG.COM posts by Email

 

Related Topics:

 

 

  1. July 26th, 2012 at 20:34 | #1

    Great submit admin! i bookmarked your net blog site. i’ll search ahead in the event you could have an e-mail variety including.

  2. July 27th, 2012 at 00:13 | #2

    Can’t say enough about this website – its alot better than mine.

  3. October 7th, 2012 at 09:48 | #3

    Nice post. I learn something totally new and challenging on websites I stumbleupon everyday.
    It will always be exciting to read through content from other writers and practice something from other websites.

  1. No trackbacks yet.