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
95460f92
Commit
95460f92
authored
Jul 23, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4360: Added client validation support for file validator
parent
1a3a266f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
30 deletions
+31
-30
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
yii.validation.js
framework/assets/yii.validation.js
+30
-30
No files found.
framework/CHANGELOG.md
View file @
95460f92
...
...
@@ -147,6 +147,7 @@ Yii Framework 2 Change Log
-
Enh #4209: Added
`beforeCopy`
,
`afterCopy`
,
`forceCopy`
properties to AssetManager (cebe)
-
Enh #4297: Added check for DOM extension to requirements (samdark)
-
Enh #4317: Added
`absoluteAuthTimeout`
to yii
\w
eb
\U
ser (ivokund, nkovacs)
-
Enh #4360: Added client validation support for file validator (Skysplit)
-
Enh: Added support for using sub-queries when building a DB query with
`IN`
condition (qiangxue)
-
Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
-
Enh: Added
`yii\web\UrlManager::addRules()`
to simplify adding new URL rules (qiangxue)
...
...
framework/assets/yii.validation.js
View file @
95460f92
...
...
@@ -17,7 +17,7 @@ yii.validation = (function ($) {
},
addMessage
:
function
(
messages
,
message
,
value
)
{
messages
.
push
(
message
.
replace
(
/
\{
(
value|file
)
\}
/g
,
value
));
messages
.
push
(
message
.
replace
(
/
\{
value
\}
/g
,
value
));
},
required
:
function
(
value
,
messages
,
options
)
{
...
...
@@ -68,54 +68,54 @@ yii.validation = (function ($) {
pub
.
addMessage
(
messages
,
options
.
notEqual
,
value
);
}
},
file
:
function
(
value
,
messages
,
options
,
attribute
)
{
file
:
function
(
value
,
messages
,
options
,
attribute
)
{
var
files
=
$
(
attribute
.
input
).
get
(
0
).
files
,
index
,
ext
;
if
(
options
.
message
&&
!
files
)
{
index
,
ext
;
if
(
options
.
message
&&
!
files
)
{
pub
.
addMessage
(
messages
,
options
.
message
,
value
);
}
if
(
!
options
.
skipOnEmpty
&&
files
.
length
==
0
)
{
if
(
!
options
.
skipOnEmpty
&&
files
.
length
==
0
)
{
pub
.
addMessage
(
messages
,
options
.
uploadRequired
,
value
);
}
else
if
(
files
.
length
==
0
)
{
}
else
if
(
files
.
length
==
0
)
{
return
;
}
if
(
options
.
maxFiles
&&
options
.
maxFiles
<
files
.
length
)
{
if
(
options
.
maxFiles
&&
options
.
maxFiles
<
files
.
length
)
{
pub
.
addMessage
(
messages
,
options
.
tooMany
);
}
$
(
files
).
each
(
function
(
i
,
file
)
{
if
(
options
.
extensions
&&
options
.
extensions
.
length
>
0
)
{
$
.
each
(
files
,
function
(
i
,
file
)
{
if
(
options
.
extensions
&&
options
.
extensions
.
length
>
0
)
{
index
=
file
.
name
.
lastIndexOf
(
'.'
);
if
(
!~
index
)
{
if
(
!~
index
)
{
ext
=
''
;
}
else
{
ext
=
file
.
name
.
substr
(
index
+
1
,
file
.
name
.
length
).
toLowerCase
();
ext
=
file
.
name
.
substr
(
index
+
1
,
file
.
name
.
length
).
toLowerCase
();
}
if
(
!~
options
.
extensions
.
indexOf
(
ext
)
)
{
pub
.
addMessage
(
messages
,
options
.
wrongExtension
,
file
.
name
);
if
(
!~
options
.
extensions
.
indexOf
(
ext
)
)
{
messages
.
push
(
options
.
wrongExtension
.
replace
(
/
\{
file
\}
/g
,
file
.
name
)
);
}
}
if
(
options
.
mimeTypes
&&
options
.
mimeTypes
.
length
>
0
)
{
if
(
!~
options
.
mimeTypes
.
indexOf
(
file
.
type
)
)
{
pub
.
addMessage
(
messages
,
options
.
wrongMimeType
,
file
.
name
);
if
(
options
.
mimeTypes
&&
options
.
mimeTypes
.
length
>
0
)
{
if
(
!~
options
.
mimeTypes
.
indexOf
(
file
.
type
)
)
{
messages
.
push
(
options
.
wrongMimeType
.
replace
(
/
\{
file
\}
/g
,
file
.
name
)
);
}
}
if
(
options
.
maxSize
&&
options
.
maxSize
<
file
.
size
)
{
pub
.
addMessage
(
messages
,
options
.
tooBig
,
file
.
name
);
if
(
options
.
maxSize
&&
options
.
maxSize
<
file
.
size
)
{
messages
.
push
(
options
.
tooBig
.
replace
(
/
\{
file
\}
/g
,
file
.
name
)
);
}
if
(
options
.
maxSize
&&
options
.
minSize
>
file
.
size
)
{
pub
.
addMessage
(
messages
,
options
.
tooSmall
,
file
.
name
);
if
(
options
.
maxSize
&&
options
.
minSize
>
file
.
size
)
{
messages
.
push
(
options
.
tooSmall
.
replace
(
/
\{
file
\}
/g
,
file
.
name
)
);
}
});
},
...
...
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