V
V
Vakha12019-03-29 13:37:01
Laravel
Vakha1, 2019-03-29 13:37:01

How to validate an array of images in laravel?

Hello, tell me how to write a rule for checking an array of images.

<input type="file" name="image[]" id="image" >
        <input type="file" name="image[]" id="image" >
        <input type="file" name="image[]" id="image" >
        <input type="file" name="image[]" id="image" >

Controller store method
public function store(Request $request){
$this->validate($request,[
"image" => And here I don't know how to check each array element.
]);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2019-03-29
@Vakha1

image.*:

[
    'image' => ['array'],
    'image.*' => ['image']
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question