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
72db6ffb
Commit
72db6ffb
authored
Dec 07, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1454: refactored FileValidator.
parent
0e67b2b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
FileValidator.php
framework/yii/validators/FileValidator.php
+7
-6
No files found.
framework/yii/validators/FileValidator.php
View file @
72db6ffb
...
...
@@ -177,27 +177,28 @@ class FileValidator extends Validator
return
[
$this
->
tooSmall
,
[
'file'
=>
$file
->
name
,
'limit'
=>
$this
->
minSize
]];
}
elseif
(
!
empty
(
$this
->
types
)
&&
!
in_array
(
strtolower
(
pathinfo
(
$file
->
name
,
PATHINFO_EXTENSION
)),
$this
->
types
,
true
))
{
return
[
$this
->
wrongType
,
[
'file'
=>
$file
->
name
,
'extensions'
=>
implode
(
', '
,
$this
->
types
)]];
}
else
{
return
null
;
}
break
;
case
UPLOAD_ERR_INI_SIZE
:
case
UPLOAD_ERR_FORM_SIZE
:
return
[
$this
->
tooBig
,
[
'file'
=>
$file
->
name
,
'limit'
=>
$this
->
getSizeLimit
()]];
case
UPLOAD_ERR_PARTIAL
:
Yii
::
warning
(
'File was only partially uploaded: '
.
$file
->
name
,
__METHOD__
);
return
[
$this
->
message
,
[]]
;
break
;
case
UPLOAD_ERR_NO_TMP_DIR
:
Yii
::
warning
(
'Missing the temporary folder to store the uploaded file: '
.
$file
->
name
,
__METHOD__
);
return
[
$this
->
message
,
[]]
;
break
;
case
UPLOAD_ERR_CANT_WRITE
:
Yii
::
warning
(
'Failed to write the uploaded file to disk: '
.
$file
->
name
,
__METHOD__
);
return
[
$this
->
message
,
[]]
;
break
;
case
UPLOAD_ERR_EXTENSION
:
Yii
::
warning
(
'File upload was stopped by some PHP extension: '
.
$file
->
name
,
__METHOD__
);
return
[
$this
->
message
,
[]]
;
break
;
default
:
break
;
}
return
null
;
return
[
$this
->
message
,
[]]
;
}
/**
...
...
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