I have a file upload field in CakePHP which allows images to be uploaded.
All is fine. All I need to do is validate the field. I am using the solution from CakePHP – Uploaded File Validation in Models:
The function is working and returning the appropriate error. I am using the following code to generate the file upload field.
echo $form->label('Game Thumbnail');
echo $form->file('Game.game_thumbnail_url');
and following code to add the validation in the model
'game_thumbnail_url' => array(
'valid_upload' => array (
'rule' => array('validateUploadedFile', false),
'message' => 'Please select a valid game thumbnail',
'allowEmpty' => false
)
),
But the error message doesn't show up, it works fine for other fields but not for this one.
How can this problem be fixed?