Im not the best at writing regex, but this could be represented as $filename = ereg_replace ("[^a-zA-Z0-9.-_]", "_", $filename);
Someone correct me if I am wrong (this is what im using to rename uploaded files, seems to work). -- Stewart --- Erik Price <[EMAIL PROTECTED]> wrote: > > On Tuesday, February 26, 2002, at 01:34 PM, Chris Hewitt wrote: > > >> I am wondering if there is anywhere a list of characters which are > not > >> allowed in a unix file name. > >> > >> I gues somethin like ' or \ is not allowed, but what else? > > My old "Teach Yourself Unix" book makes it: > > !@#$%^&()[]'"?\|;<>`+- space tab backspace > > though it says technically some could be used but might cause > problems. > > As a general rule, filenames should only ever be composed of the > following characters: > > letters (A-Z and a-z) > numbers (0-9) > underscorese (_) > hyphens (-) > dots (.) > > Surely there will be some disagreement with this, but it's our policy > > where I work to make certain that filenames can only be composed of > these characters. I even have the CMS I'm designing set so that > nonconformant filenames are not allowed, with a message explaining > why. > The characters to be especially careful to avoid are: > > forward-slashes (/) > backslashes (\) > quotes (') > doublequotes (") > colons (:) > spaces ( ) > > The slashes are usually filesystem hierarchic delimiters on Windows > and > Unix, as is the colon on pre-OS 9 Mac filesystems. Quotes and > doublequotes are usually used to escape command line strings, so they > > can cause confusion (note that this includes singlequotes used as > apostrophes, like "John'spicture.jpg"). It's not that you can't use > quotes, but it forces the person manipulating them to be very careful > > about how they refer to the filename. Likewise, spaces need to be > escaped, so they're a bad idea. > > This is just my opinion, but I'm sure others will agree. > > Erik > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php