Bounty available!

It has been a while and this question still does not have any answers. Answer this question and get additional +162 points of karma/reputation if the original poster accepts your reply as correct answer

File Upload / Form Validation

Hi, I am trying to validate a File field in my form and it is always giving me empty error.

Here is my file field in the form

$facilityimage = new File('facilityimage');

    new \Phalcon\Validation\Validator\File([
        'maxSize' => '0.5M',
        'messageSize' => 'Your image is too big. Max file size: 500KB',
        'allowedTypes' => array('image/jpeg', 'image/png'),
        'messageType' => 'Your image must be a JPEG or PNG file',
        'messageEmpty' => 'No image uploaded'


In my Action, I have tried passing $_POST and $_FILES as follows:

if (!$form->isValid(array_merge($this->request->getPost(), $this->request->getUploadedFiles(true)))) {
    foreach ($form->getMessages() as $message)
        $this->flash->error((string) $message);

I have checked the forums and none of the solutions provided is working for now. I am using Phalcon 4.

Ok it is working with $_FIles instead of $this->request->getUploadedFiles(true).

In my opinion it should work with native Phalcon alternative of $_FILES.

Another Question Documentation showing messageFileEmpty variable for setting empty message however both messageFileEmpty as well as messageEmpty are not being overriden in forms. Only default message is being shown.

Any help will be appreciated.