note 87255 rejected from features.file-upload by danbrown

From: Date: Wed, 26 Nov 2008 21:15:53 +0000
Subject: note 87255 rejected from features.file-upload by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147003@lists.php.net to get a copy of this message
Note Submitter: quantumsized at gmail dot com ---- In reply to: bokiatenxi at yahoo dot com 03-Apr-2008 11:57 I use this one which works better for me instead of using strrchr to get the file extension the easier and fool proof way is to use substr() like so: $ext = substr($filename, -3); // for the last three $ext = substr($filename, -4); // for the dot too or if you where to want to be really sure: $base_file = basename($filename); $ext = substr($base_file, -3); // and so on There are many ways to do things and some work better for some people and on some builds. I have worked extensively with string functions and this is my favorite.

« previous php.notes (#147003) next »