Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple rules in validate() for File Upload not working #1201

Closed
samsonasik opened this issue Sep 5, 2018 · 2 comments
Closed

multiple rules in validate() for File Upload not working #1201

samsonasik opened this issue Sep 5, 2018 · 2 comments

Comments

@samsonasik
Copy link
Member

Based on documentation, it shown :

$this->validate([
    'avatar' => 'uploaded[avatar]|max_size[avatar,1024]'
]);

It will get the following error:

CodeIgniter\Validation\Exceptions\ValidationException: up is not a valid rule.

The current working solution is:

$this->validate([
    'avatar' => [
            'uploaded[avatar]',
            'max_size[avatar,1024]',
        ],
]);

is it the documentation issue or the Validation bug ?

@samsonasik
Copy link
Member Author

Checking the Validation::splitRules(), it got the following:

/Users/samsonasik/www/CodeIgniter4/system/Validation/Validation.php:738:
array (size=5)
  0 => string 'up' (length=2)
  1 => string 'oa' (length=2)
  2 => string 'ed' (length=2)
  3 => string 'avatar]' (length=7)
  4 => string 'max_size[avatar,1024]' (length=21)

The issue seems on it.

@osagiesammy
Copy link

Thank you @samsonasik I have been on this for more thank three days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants