Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rashan88's avatar

How to validate file count ( example maximum 5 images are allowed) in laravel 5.6

`` request()->validate([

        'images.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',

]); ``

0 likes
1 reply
bobbybouwmann's avatar

I need two validations here

request()->validate([
    'images' => 'max:5', // checks length of array
    'images.*' => 'max:2048', // checks file size
]);
1 like

Please or to participate in this conversation.