note 87255 added to features.file-upload
| From: | quantumsized at gmail dot com | Date: | Wed, 26 Nov 2008 20:52:17 +0000 |
| Subject: | note 87255 added to features.file-upload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-147000@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 208.69.120.35
Probable Submitter: 66.243.225.50
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.php
Edit -- https://master.php.net/note/edit/87255
Del: integrated -- https://master.php.net/note/delete/87255/integrated
Del: useless -- https://master.php.net/note/delete/87255/useless
Del: bad code -- https://master.php.net/note/delete/87255/bad+code
Del: spam -- https://master.php.net/note/delete/87255/spam
Del: non-english -- https://master.php.net/note/delete/87255/non-english
Del: in docs -- https://master.php.net/note/delete/87255/in+docs
Del: other reasons-- https://master.php.net/note/delete/87255
Reject -- https://master.php.net/note/reject/87255
Search -- https://master.php.net/manage/user-notes.php