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.
removing quotes from a file name......
Moderator: General Moderators
I'm not sure what you mean by cleaner, but I'd just do this:
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.
Code: Select all
<?php
str_replace('"', '', $filename);
str_replace("'", "", $filename);
?>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.