I am using "Validation\Validator\File" to validate an uploaded file:
$validator->add(
'image',
new Validation\Validator\File([
'maxSize' => $this->getValidationConfig()->maxSize,
'allowedTypes' => $this->getValidationConfig()->allowedTypes,
'maxResolution' => $this->getValidationConfig()->maxResolution,
'messageSize' => ':field exceeds ' . DigitalUnitsConverterUtil::bytesToMb(
$this->getValidationConfig()->maxSize) . ' Mb',
'allowEmpty' => false
])
);
The value being validated is:
$validator->validate([
'image' => $this->image,
])
And $this->image
is being set inside method "onConstruct()":
public function onConstruct()
{
$this->image = $this->request->getUploadedFiles('image')[0];
}
But, always the validator says that value is empty. I used xdebug to check, but the value is not empty and contains "Phalcon\Http\Request\File".
What is going wrong ?