note 51928 added to function.is-uploaded-file

From: Date: Fri, 15 Apr 2005 11:21:20 +0000
Subject: note 51928 added to function.is-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-88054@lists.php.net to get a copy of this message
Regarding the comment of info at metaltoad dot net @ 19-Feb-2003 04:03 <?php // ... yada yada yada... preg_match("/.exe$|.com$|.bat$|.zip$|.doc$|.txt$/i", $HTTP_POST_FILES['userfile']['name'])) // ... yada yada yada... ?> This will not work. It will, but not correctly. You shuld escape the . (dot) for the preg function, and escape the $ (dollar) sign for PHP, or use single-quoted string... The syntax should be (much shorter and neater): <?php // ... yada yada yada... preg_match('/\\.(exe|com|bat|zip|doc|txt)$/i', $_FILES['userfile']['name'])) // ... yada yada yada... ?> ---- Manual Page -- http://www.php.net/manual/en/function.is-uploaded-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51928 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51928&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51928&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51928&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51928&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51928&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51928&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88054) next »