The $errors array also contains array for those fields. You should be able to access each element like this:
{{ $errors->has('images.0') ? $errors->first('images.0') }}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I've been stuck in a kind of bug for 2 days so far and I'm really desperate. I'm trying to validate a multiple input file with others fields, the validation works as expected, but the problem is when I want to know in which field the error was in order to display the proper message.
I'm using something like:
$rules = [
'field_1' => 'rule',
....
....
'field_n' => 'rule',
....
'images.*' => 'required|mimes:jpeg,bmp,png,gif|max:40000'
];
$messages = [
'field_1.required' => 'message_for_rule'
....
'field_n' => 'rule',
....
'images.*.required' => 'message_for_required',
'images.*.mimes' => 'message_for_mimes',
'images.*.max' => 'message_for_max'
];
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return Redirect::back()
->withErrors($validator)
->withInput();
}
Which is the correct way to display errors for the multiple files in blade template? I hope you Could help me (I'm not used to ask for help, but I could not make it work).
That's a well known error. I finished this doing a manual validation, using the php artisan make:request command and customizing the Request method.
Please or to participate in this conversation.