Web friendly file names
| From: | Skip Evans | Date: | Wed, 03 Jun 2009 16:18:57 +0000 |
| Subject: | Web friendly file names | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-293541@lists.php.net to get a copy of this message | ||
Hey all,
I have a file uploader module that allows users to upload documents and of course people are using all kinds of file names that are not web friendly.
I guess the best solution is to replace any non alphanumeric with maybe '_' the underscore? How does that sound?
Unfortunately, after 20+ years of coding I cannot get my brain around regular expressions to any decent level of proficiency, I know sad.
I'd like to hear other solutions for this problem, I am thinking of a regexp that replaces special chars with the underscore; sounds pretty robust and globally acceptable?
Opinions, witticisms, flames, quotations by famous débutantes?
(The last is optional)
--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut