You are here: Re: [PHP] String with front slashes..... « PHP « IT news, forums, messages
Re: [PHP] String with front slashes.....

Posted by John Nichel on 07/19/05 19:28

Jay Blanchard wrote:
> I have the potential for strings where the string will contain a front
> slash;
>
> index_Foo_Communications_c/o_Bar_Enterprises_20050718
>
> I want to use the string to name a text file
>
> index_Foo_Communications_c/o_Bar_Enterprises_20050718.txt
>
> but it always fails to open the file because of the front slash. I have
> completely brain farted on how to escape this (perhaps only 2 hours of
> sleep last night) and I cannot find what I am looking for in the manual.
> addslashes? mysql_real_escape_string? nope...nope...ack. Coffee...where
> is the coffee? What do you mean, "I didn't make any more?" Are you new
> here?

I'd say it would be best to keep that slash out of the filename. Do a
regex on the string before doing anything else....

preg_replace ( "/\//", "-", $string );

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com

 

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

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