Hi I'm trying to do a validation for a file field on Cakephp3. This is what I have so far.
$validator
->add('file_upload', 'custom', [
'rule' => function ($value, $context) {
return empty($context['data']['file_type']);
},
'message' => 'Cannot be empty if file type is filled out'
]);
I originally had allow empty for this field but realized that the file types comes in as an array and wouldn't validate properly, so tried to used a custom validator and still doesn't seem to work. Comments and critiques are welcomed.