mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merged revisions 47621 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r47621 | ischommer | 2008-01-04 21:44:07 +1300 (Fri, 04 Jan 2008) | 1 line added get_file_extension() ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52398 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
46dc0e805c
commit
00f95679ce
@ -401,7 +401,18 @@ class File extends DataObject {
|
|||||||
* legacy code.
|
* legacy code.
|
||||||
*/
|
*/
|
||||||
function getExtension() {
|
function getExtension() {
|
||||||
return strtolower(substr($this->getField('Filename'),strrpos($this->getField('Filename'),'.')+1));
|
return self::get_file_extension($this->getField('Filename'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the extension of a filepath or filename,
|
||||||
|
* by stripping away everything before the last "dot".
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_file_extension($filename) {
|
||||||
|
return strtolower(substr($filename,strrpos($filename,'.')+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFileType() {
|
function getFileType() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user