Results 1 to 4 of 4
-
11-27-2010 #1
[PHP] Getting The Extension Of A File
Just thought I'd share this very quickly. Works nicely when verifying file types.
The following would display the extension, "bar" from the filename, "TheFileName.foo.bar"
PHP Code:<?php
//Replace with subject filename
$fName = "TheFileName.foo.bar";
//Splits up the filename
$fNameExp = explode(".", $fName);
//How many parts?
$fNameCount = count($fNameExp);
//Get the last bit
$fExt = $fNameExp[$fNameCount-1];
echo($fExt);
?>
-
-
11-27-2010 #2
Re: [PHP] Getting The Extension Of A File
Thanks for the Help Jordan. It can help on later work. Thanks again.
-
11-27-2010 #3
Re: [PHP] Getting The Extension Of A File
thx for the post
I will answer any and all questions regarding my big toe.
-
11-27-2010 #4Official Grapist
- Join Date
- Jul 2010
- Location
- !↨ ↨ΦΘΘB7▐♂▬!*▀
- Age
- 19
- Posts
- 3,284
- Thanks
- 719
- Gamertag
- Crazzzme
Re: [PHP] Getting The Extension Of A File
thats very efficient looking and seems very straight forward good post
Press thanks if i helped you
and If i helped you dont be a little ass and not thank me.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)



LinkBack URL
About LinkBacks
Reply With Quote




Bookmarks