note 76030 added to function.is-file
| From: | cristiandotbanatneobytesolutionscom at osu1 dot php dot net | Date: | Wed, 27 Jun 2007 08:46:21 +0000 |
| Subject: | note 76030 added to function.is-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128016@lists.php.net to get a copy of this message | ||
regarding note from rehfeld dot us :
In my experience the best( and easiest ) way to find the extension of a file is :
<?php
// use this when you are sure it actually has an extension.
$extension = end(explode(".", $file_name));
?>
or
<?php
// this one will also check if it actually has an extension
$parts = explode(".", $file_name);
if (is_array($parts) && count($parts) > 1)
$extension = end($parts);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 85.186.102.76
----
Manual Page -- http://www.php.net/manual/en/function.is-file.php
Edit -- https://master.php.net/note/edit/76030
Del: integrated -- https://master.php.net/note/delete/76030/integrated
Del: useless -- https://master.php.net/note/delete/76030/useless
Del: bad code -- https://master.php.net/note/delete/76030/bad+code
Del: spam -- https://master.php.net/note/delete/76030/spam
Del: non-english -- https://master.php.net/note/delete/76030/non-english
Del: in docs -- https://master.php.net/note/delete/76030/in+docs
Del: other reasons-- https://master.php.net/note/delete/76030
Reject -- https://master.php.net/note/reject/76030
Search -- https://master.php.net/manage/user-notes.php