You are here: Re: Uploads and mime type « PHP Programming Language « IT news, forums, messages
Re: Uploads and mime type

Posted by Mad Hatter on 11/16/07 11:49

Hi
>
> A quick and dirty way to get the extension:
>
> $extension = strrev(substr(strrev($_FILES['userfile']['name']), 0,
> strpos(strrev($_FILES['userfile']['name']), '.')));
>
> (It reverses a string so that it gets the first from the end then
> reverses the result)

That's a much better method than the one I was going to use :-
$upname=($_FILES["userfile"]["name"]);
$extension = substr($upname, strrpos($upname, '.') + 1);

Thanks for that :)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация