Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
264e6110
Commit
264e6110
authored
Jan 08, 2014
by
andrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UplodedFile enhasement
parent
29693f68
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
UploadedFile.php
framework/yii/web/UploadedFile.php
+16
-10
No files found.
framework/yii/web/UploadedFile.php
View file @
264e6110
...
@@ -33,20 +33,12 @@ class UploadedFile extends Object
...
@@ -33,20 +33,12 @@ 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.
...
@@ -173,6 +165,22 @@ class UploadedFile extends Object
...
@@ -173,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.
*/
*/
...
@@ -216,9 +224,7 @@ class UploadedFile extends Object
...
@@ -216,9 +224,7 @@ 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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment