So the title says all, other rules like "mimes" are works, but I can submit form without file upload. Ofcourse I can use "required" attr in HTML, but I don't want to.
Controller
$rules = [
'img.*' => 'required|mimes:png,jpeg,jpg',
];
$customMessages = [
'img.required' => 'Yo, what should I call you?',
];
$this->validate($request, $rules, $customMessages);
View
<div class="form-group">
<label for="img">File input</label>
<input type="file" class="form-control-file" id="img" value="" name="img[]">
<small class="text-danger"></small>
</div>
I have other inputs, but with type="text"
and their "required"
rule works fine. Whats wrong with type="file"
? Can't find the answer...
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire