@Sunman Singh's answer is not true anymore.
static Validation::extension(mixed $check, array $extensions = array('gif', 'jpeg', 'png', 'jpg'))
This rule checks for valid file extensions like .jpg or .png. Allow
multiple extensions by passing them in array form.
public $validate = array(
'image' => array(
'rule' => array(
'extension',
array('gif', 'jpeg', 'png', 'jpg')
),
'message' => 'Please supply a valid image.'
)
);
static Validation::fileSize($check, $operator = null, $size = null)
This rule allows you to check filesizes. You can use $operator to
decide the type of comparison you want to use. All the operators
supported by comparison() are supported here as well. This method will
automatically handle array values from $_FILES by reading from the
tmp_name key if $check is an array and contains that key:
public $validate = array(
'image' => array(
'rule' => array('fileSize', '<=', '1MB'),
'message' => 'Image must be less than 1MB'
)
);
See the link below for references. Altough, I'd recommend writting your own function for more security but those can certainly save you some time
http://book.cakephp.org/2.0/en/models/data-validation.html#Validation::extension