note 54066 added to function.ereg

From: Date: Wed, 22 Jun 2005 19:56:48 +0000
Subject: note 54066 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-90805@lists.php.net to get a copy of this message
While this is relatively simple example, I was unable find a clean method of doing this anywhere else, so I thought I would post it here. As part of a file upload package, I wanted to prevent the uploading of double byte character filenames and other special ASCII characters that may not work well on a Windows and/or Linux system. Here is the statement I ended up using which seems to have done the trick. ereg("[^a-zA-Z0-9._-]", $file_name) ---- Manual Page -- http://www.php.net/manual/en/function.ereg.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54066 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54066&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54066&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54066&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54066&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54066&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54066&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54066&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90805) next »