note 43962 added to function.move-uploaded-file
| From: | StephenWilliams at rn2 dot php dot net | Date: | Sat, 10 Jul 2004 04:57:38 +0000 |
| Subject: | note 43962 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72976@lists.php.net to get a copy of this message | ||
You can find the file extension using this function:
$VAR_file = "test.jpg";
$VAR_extension = get_file_extension($VAR_file); //returns jpg
function get_file_extension($VAR_file_name) {
$VAR_pieces = explode(".", $VAR_file_name);
$VAR_piece_count = count($VAR_pieces) - 1;
$VAR_this_extension = $VAR_pieces[$VAR_piece_count];
return $VAR_this_extension;
}
This works on all files, even ones with multiple .'s in them.
Example
test.jpg will return "jpg"
test.test.test.test.jpg will return "jpg"
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43962
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43962&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43962&report=yes
Search -- http://master.php.net/manage/user-notes.php