问题
How to validation number of files. I find many way and read alot of topic. But i can't found this result. I found only validation files size.
'files' => 'size:2560|max:2560'
All of this only files size. How can I know number of files.
回答1:
It seems that there is no default rule for the number of files. However, you can write a custom rule for validation.
https://laravel.com/docs/5.3/validation#rule-file
Please have a look here for a sample on implementation for the same.
Limit number of files that can be uploaded
回答2:
if your files is an array max checks array length.
'files' => 'max:5' //maximum number of files: 5
'files.*' => 'max:5' //maximum size of each file: 5kb
来源:https://stackoverflow.com/questions/41328265/how-to-validation-number-of-files