Re: separating strings from extensions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since you provide the suffice (extension) to basename, it's not
basename that's broken...

It's not knowing what extension you wanted to provide in the first
place...

On Mon, February 18, 2008 11:56 am, Nick Stinemates wrote:
> Richard Lynch wrote:
>> On Sun, February 17, 2008 4:37 pm, nihilism machine wrote:
>>
>>> i am using this code to get the extension of a filename:
>>>
>>> $extension = strtolower(strrchr($fileName,"."));
>>>
>>> how can i get the text BEFORE the . (period)
>>>
>>
>> http://php.net/basename
>>
>>
> Funny enough, even in the comments someone states 'this breaks for
> complex file-ending like .tar.gz'
>
> Considering file names don't mean much, it would be OK (imo) to use
> basename for standard operations. If you're working/looking for the
> exact type, it's time to use MIME as it is more reliable than
> something
> like a filename.
>
> http://us2.php.net/manual/en/ref.mime-magic.php
>
> Good luck.
>
> ==================
> Nick Stinemates (nick@xxxxxxxxxxxxxx)
> http://nick.stinemates.org
>
> AIM: Nick Stinemates
> MSN: nickstinemates@xxxxxxxxxxx
> Yahoo: nickstinemates@xxxxxxxxx
> ==================
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux