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
3ef20e59
Commit
3ef20e59
authored
Nov 05, 2013
by
Gudz Taras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overriding validateFile()
parent
c8596fdb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
17 deletions
+5
-17
ImageValidator.php
framework/yii/validators/ImageValidator.php
+5
-17
No files found.
framework/yii/validators/ImageValidator.php
View file @
3ef20e59
...
...
@@ -140,28 +140,16 @@ class ImageValidator extends FileValidator
}
/**
* Validates the attribute of the object using {@link validateImage}.
* If there is any error, the error message is added to the object.
* Internally validates a file object.
* @param \yii\base\Model $object the object being validated
* @param string $attribute the attribute being validated
* @param UploadedFile $file uploaded file passed to check against a set of rules
*/
p
ublic
function
validateAttribute
(
$object
,
$attribut
e
)
p
rotected
function
validateFile
(
$object
,
$attribute
,
$fil
e
)
{
parent
::
validateAttribute
(
$object
,
$attribute
);
if
(
$object
->
hasErrors
())
{
return
;
}
parent
::
validateFile
(
$object
,
$attribute
,
$file
);
if
(
$this
->
maxFiles
>
1
)
{
$files
=
$object
->
$attribute
;
$object
->
$attribute
=
array_values
(
$files
);
foreach
(
$files
as
$file
)
{
$this
->
validateImage
(
$object
,
$attribute
,
$file
);
}
}
else
{
$file
=
$object
->
$attribute
;
if
(
false
===
$object
->
hasErrors
(
$attribute
))
{
$this
->
validateImage
(
$object
,
$attribute
,
$file
);
}
}
...
...
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