Hi, for some reason when I try to upload a file it is failing the max file size validation rule I stablished even though the file is only 18kb.
Error:
:
["The file must be 3000 kilobytes."]```
This is the form request where validation rules reside:
```php
public function rules()
{
return [
'name' => 'required|string|min:3',
'email' => 'required|email',
'body' => 'required|string|min:5',
'file' => 'required|mimes:doc,pdf,docx,zip,odt|size:3000'
];
}
Why is this happening, the size of the file I'm uploading is 18kb, and the validation rule is size:3000 which is 3mbs, much much more
The size rule is exact (must be 3000). You probably want the max rule, so it can be size 0 up to the max.
max:value
The field under validation must be less than or equal to a maximum value. Strings, numerics, arrays, and files are evaluated in the same fashion as the size rule.
size:value
The field under validation must have a size matching the given value. For string data, value corresponds to the number of characters. For numeric data, value corresponds to a given integer value. For an array, size corresponds to the count of the array. For files, size corresponds to the file size in kilobytes.