You are here: Re: strpos - and multiple needles? « PHP Programming Language « IT news, forums, messages
Re: strpos - and multiple needles?

Posted by My Pet Programmer on 12/28/07 16:32

jodleren said:
> On Dec 28, 5:41 pm, Iván Sánchez Ortega <ivansanchez-...@rroba-
> escomposlinux.-.punto.-.org> wrote:
>> jodleren wrote:
>>> On Dec 28, 5:20 pm, Iván Sánchez Ortega <ivansanchez-...@rroba-
>>> escomposlinux.-.punto.-.org> wrote:
>>>> jodleren wrote:
>>>>> To check for invalid characters in a filename
>>>> Escape the filename, then.
>>> Sorry, I dont get this one.
>> OK... why do you need to check for invalid characters in a filename?
>>
>> In other words, where could a filename with "strange" characters cause
>> damage to your system?
>
> Windows based systems do not allow certain characters. I need to check
> for them, _even_ that my server can handle them, I still have to think
> of the user downloading a file etc....
Been there, definitely.


preg_match('/^([a-zA-Z]\:)(\\[^\\/:*?<>"|]*(?<![
]))*(\.[a-zA-Z]{2,6})$/', $filename);

That one should only match valid filenames.

~A!




--
Anthony Levensalor
anthony@mypetprogrammer.com

Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. - Albert Einstein

 

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

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