I'm trying to validate on a max file size of 500kb in Laravel:
$validator = Validator::make($request->all(), [
'file' => 'size:500',
]);
But this says that the file should be exactly 500kb big. How can I edit this rule so that it returns an error when it's bigger than 500kb?
Ive tried this:
'file' => 'size:>=500'
'file' => 'size:max:500'
The documentation says nothing about this:
size:value
The field under validation must have a size matching the given value.
For string data, the value corresponds to the number of characters. For
numeric data, the value corresponds to a given integer value. For files,
size corresponds to the file size in kilobytes.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…