0
I have the following validation rule in the controller:
$validator = Validator::make($request->all(), [
'nome' => 'required|max:255',
'valor' => 'required|numeric|min: 0',
'imagens' => 'required|mimes:jpeg,jpg,png|max:1000',
'descricao' => 'max: 255',
'finalidade' => 'max: 255',
'area' => 'required|numeric|min:0',
'quartos' => 'required|numeric|min:0',
'banheiros' => 'required|numeric|min:0',
'garagens' => 'required|numeric|min:0',
'suites' => 'required|numeric|min:0',
'imagens.*' => 'required|mimes: jpeg,jpg,bmp,png'
]);
With an input file as follows:
<input type="file" name="imagens[]" multiple value="{{ old('imagens') }}" id="" class="form-control">
Even when I upload 2 files . jpg the validation fails, saying the format has to be jpg.
I think the validation should be done file by file. Someone can do this?
Have you tried removing this line
'imagens' => 'required|mimes:jpeg,jpg,png|max:1000',
and leaving only this'imagens.*' => 'required|mimes:jpeg,jpg,bmp,png'
?– Valdeir Psr
Yes. Actually I hadn’t seen that it was duplicated. Vi now, but even removing, individually points out that the file 1 and 2 must have jpg format. Strange, because they are in this format...
– Gabriel Augusto