Browse Source

UplodedFile enhasement

tags/2.0.0-beta
andrey 11 years ago
parent
commit
29693f68fd
  1. 10
      framework/yii/web/UploadedFile.php

10
framework/yii/web/UploadedFile.php

@ -33,12 +33,20 @@ class UploadedFile extends Object
*/ */
public $name; public $name;
/** /**
* @var string the original base file name
*/
public $baseName;
/**
* @var string the path of the uploaded file on the server. * @var string the path of the uploaded file on the server.
* Note, this is a temporary file which will be automatically deleted by PHP * Note, this is a temporary file which will be automatically deleted by PHP
* after the current request is processed. * after the current request is processed.
*/ */
public $tempName; public $tempName;
/** /**
* @var string file extension.
*/
public $extension;
/**
* @var string the MIME-type of the uploaded file (such as "image/gif"). * @var string the MIME-type of the uploaded file (such as "image/gif").
* Since this MIME type is not checked on the server side, do not take this value for granted. * Since this MIME type is not checked on the server side, do not take this value for granted.
* Instead, use [[FileHelper::getMimeType()]] to determine the exact MIME type. * Instead, use [[FileHelper::getMimeType()]] to determine the exact MIME type.
@ -208,7 +216,9 @@ class UploadedFile extends Object
} else { } else {
self::$_files[$key] = new static([ self::$_files[$key] = new static([
'name' => $names, 'name' => $names,
'baseName' => pathinfo($names, PATHINFO_FILENAME),
'tempName' => $tempNames, 'tempName' => $tempNames,
'extension' => strtolower(pathinfo($names, PATHINFO_EXTENSION)),
'type' => $types, 'type' => $types,
'size' => $sizes, 'size' => $sizes,
'error' => $errors, 'error' => $errors,

Loading…
Cancel
Save