diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 7716d1a..ccae779 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -80,6 +80,7 @@ Yii Framework 2 Change Log - New #66: [Auth client library](https://github.com/yiisoft/yii2-authclient) OpenId, OAuth1, OAuth2 clients (klimov-paul) - New #1393: [Codeception testing framework integration](https://github.com/yiisoft/yii2-codeception) (Ragazzo) - New #1438: [MongoDB integration](https://github.com/yiisoft/yii2-mongodb) ActiveRecord and Query (klimov-paul) +- Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic) 2.0.0 alpha, December 1, 2013 --------------------------- diff --git a/framework/yii/web/UploadedFile.php b/framework/yii/web/UploadedFile.php index 1de4d46..5e1e428 100644 --- a/framework/yii/web/UploadedFile.php +++ b/framework/yii/web/UploadedFile.php @@ -163,6 +163,22 @@ class UploadedFile extends Object } return false; } + + /** + * @return string original file base name + */ + public function getBaseName() + { + return pathinfo($this->name, PATHINFO_FILENAME); + } + + /** + * @return string file extension + */ + public function getExtension() + { + return strtolower(pathinfo($this->name, PATHINFO_EXTENSION)); + } /** * @return boolean whether there is an error with the uploaded file.