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
[Back to original message]
|