Browse Source

Merge pull request #1839 from anfrantic/master

UplodedFile enhasement
tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
6423c41233
  1. 1
      framework/CHANGELOG.md
  2. 16
      framework/yii/web/UploadedFile.php

1
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 #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
--------------------------- ---------------------------

16
framework/yii/web/UploadedFile.php

@ -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.
*/ */

Loading…
Cancel
Save