note 70815 added to function.pathinfo
| From: | tzveeka at tzveeka dot com | Date: | Sun, 29 Oct 2006 20:19:52 +0000 |
| Subject: | note 70815 added to function.pathinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119235@lists.php.net to get a copy of this message | ||
if the file you're trying to get an extension from has variables attached to it like this one:
jhonson.gif?xxx=1
use this to get the extension without the variables:
// Creating a new file name using the file code:
$path_parts = pathinfo($file_name);
//Lowering all extensions to low caps!
$extension = strtolower($path_parts['extension']);
// if file has variables removing them from extension:
if (!(strpos($extension, "?") === false)) {
$extension = substr($extension,0, strpos($extension, "?"));
}
----
Server IP: 192.117.122.43
Probable Submitter: 87.69.6.235
----
Manual Page -- http://www.php.net/manual/en/function.pathinfo.php
Edit -- https://master.php.net/note/edit/70815
Del: integrated -- https://master.php.net/note/delete/70815/integrated
Del: useless -- https://master.php.net/note/delete/70815/useless
Del: bad code -- https://master.php.net/note/delete/70815/bad+code
Del: spam -- https://master.php.net/note/delete/70815/spam
Del: non-english -- https://master.php.net/note/delete/70815/non-english
Del: in docs -- https://master.php.net/note/delete/70815/in+docs
Del: other reasons-- https://master.php.net/note/delete/70815
Reject -- https://master.php.net/note/reject/70815
Search -- https://master.php.net/manage/user-notes.php