#5708: Can't use validation rule 'extension' with allowEmpty
-------------------------------+--------------------------------------------
Reporter: obache | Type: Bug
Status: new | Priority: Medium
Milestone: 2.0.0.x | Component: General
Version: RC3 | Severity: Normal
Keywords: | Php_version: PHP 5
Cake_version: 1.2.0.7692 RC3 |
-------------------------------+--------------------------------------------
I want to use file extension validation if upload file is specified, then
add following settings in model:
{{{
#!php
$validate = array(
'pict' => array (
'notempty' => array(
'rule' => 'notEmpty',
'on' => 'create',
'last' => 'true',
'message' => 'picture is required for regist'),
'extcheck' => array(
'rule' => array('extension', array('jpeg',
'jpg')),
'allowEmpty' => true,
'message' => 'only jpeg is allowed'
)
)
)
}}}
But even if upload file is not specified, extensin validation is used and
error message is appeared.
Attached patch change to treat error != UPLOAD_ERR_OK same as empty input
and works as I expected.
--
Ticket URL: <https://trac.cakephp.org/ticket/5708>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---