RE: [PHP] File Uploads
| From: | Martin Lindhe | Date: | Thu, 13 Sep 2001 15:53:39 +0000 |
| Subject: | RE: [PHP] File Uploads | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-67242@lists.php.net to get a copy of this message | ||
> Greetings:
>
> Looking for a way to say *.php in this code:
> if ($file != ".htaccess" && $file != "." && $file !=
> ".."
> && $file != ANY PHP FILE)
>
>
> I have tried *.php...
>
separate the file extension from the $file
with code looking something like this:
$ext = substr($file,strrpos($file,"."));
if $file contains "test.php", then $ext now
contains ".php". so change your code to something like:
--snip--
$ext = substr($file,strrpos($file,"."));
if ($file != ".htaccess" && $file != "." && $file !=
".."
&& $ext != ".php")
--snip--
good luck!
/Martin