Re: Stripping out all illegal characters for a folder name
| From: | Sophie Mattoug | Date: | Wed, 26 Nov 2003 15:55:14 +0000 |
| Subject: | Re: Stripping out all illegal characters for a folder name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171085@lists.php.net to get a copy of this message | ||
Joseph Szobody wrote:
Folks, I'm taking some user input, and creating a folder on the server. I'm already replacing " " with "_", and stripping out a few known illegal characters (', ", /, \, etc). I need to be sure that I'm stripping out every character that cannot be used for a folder name. What's the best way to do this? Do I have to manually come up with a comprehensive list of illegal characters, and then str_replace() them one by one?I think you should use the reverse solution : have a list of authorized characters and strip out all others ones.
There's gotta be a better way to do this... Joseph