Page 1 of 1

removing quotes from a file name......

Posted: Thu Feb 26, 2004 5:21 pm
by dull1554
i have a seemingly simple question that has turned out to give me some trouble, my question is, is there a way to remove quotes, single or double from a file name before upload???????


i've googled it, i've searced this forum, maybe i'm just not so smart but i can't seem to find a way of doing it short of str_replace or something like that, i just wondered if there was a better way.

Posted: Thu Feb 26, 2004 5:26 pm
by uberpolak
You say that as if there's something wrong with using str_replace... Why not use it?

Posted: Thu Feb 26, 2004 5:34 pm
by dull1554
no i never said there was anything wrong with using str_replace, i was mearly looking for a "CLEANER" method, but i'm ready to just breakdown and do it the easy way

Posted: Thu Feb 26, 2004 5:41 pm
by uberpolak
I'm not sure what you mean by cleaner, but I'd just do this:

Code: Select all

<?php
str_replace('"', '', $filename);
str_replace("'", "", $filename);
?>
I'm not sure how that's "dirty." Might be a little confusing to read, due to the massive quotefest going on, but the first line ditches double-quotes, the second single.

I included the code because I thought if you were thinking str_replace wasn't clean you would've been doing it a different way. Unless there's something I don't see happening here.