Dealing with spaces and punctuation in uploaded filenames (tjlq)

From: Date: Sun, 14 Jul 2002 01:20:13 +0000
Subject: Dealing with spaces and punctuation in uploaded filenames (tjlq)
Groups: php.general 
Request: Send a blank email to php-general+get-107551@lists.php.net to get a copy of this message
I am using this basic example (from the manual iirc) for uploading files <form enctype="multipart/form-data" action="upload.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="1000" /> Upload this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> What I am trying to do then is to remove any spaces or punctuation that might be in the filename. This is what I am using for the filename: $FILENAME = $_FILES['userfile']['name']; and this is what I was trying to use to remove the space and punctuation (all one line, might wrap in email): $SAFEFILENAME = ereg_replace ("[[:punct:]]+[[:blank:]]+", "", $FILENAME); But that does not seem to be working, and I have not been able to figure out why. Any help appreciated. Thanks TjL

« previous php.general (#107551) next »