Commit 6423c412 by Qiang Xue

Merge pull request #1839 from anfrantic/master

UplodedFile enhasement
parents c6c51baa 2619fb09
...@@ -80,6 +80,7 @@ Yii Framework 2 Change Log ...@@ -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 #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 #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) - 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 2.0.0 alpha, December 1, 2013
--------------------------- ---------------------------
......
...@@ -165,6 +165,22 @@ class UploadedFile extends Object ...@@ -165,6 +165,22 @@ class UploadedFile extends Object
} }
/** /**
* @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. * @return boolean whether there is an error with the uploaded file.
* Check [[error]] for detailed error code information. * Check [[error]] for detailed error code information.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment