Skip to content

Commit 66e4baf

Browse files
authored
Update examples.rst
1 parent 97eb2ed commit 66e4baf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/examples.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,29 @@ Basic example
6666
<?php echo $this->Form->input('username'); ?>
6767
<?php echo $this->Form->input('photo', ['type' => 'file']); ?>
6868
<?php echo $this->Form->end(); ?>
69+
70+
Note: If you used *bake* to generate MVC structure after creating
71+
the users table, you will need to remove the default scalar validation
72+
for the photos field.
73+
74+
.. code:: php
75+
public function validationDefault(Validator $validator)
76+
{
77+
$validator
78+
->integer('id')
79+
->allowEmpty('id', 'create');
80+
81+
$validator
82+
->scalar('username')
83+
->allowEmpty('username');
84+
85+
$validator
86+
// remove ->scalar('photo')
87+
->allowEmpty('photo');
88+
89+
return $validator;
90+
}
91+
?>
6992
7093
Deleting files
7194
--------------

0 commit comments

Comments
 (0)