I have form where i have an input to do a file upload:
HTML:
<form method="POST" enctype="multipart/form-data" action="/admin/dashboard/category/{{$action}}">
...
<fieldset class="form-group">
<label for="image">Imagem</label>
<input type="file" id="image" name="mainImg">
</fieldset>
...
</form>
ControllerPost:
use Validator;
....
$rules = array('mainImg' => 'image|max:1024*1024');
$messages = array(
'mainImg.image' => 'Must be an image (jpg, gif or png)',
'mainImg.max' => 'heavy file... upload max is 1 MB'
);
$validator = Validator::make($request->all(), $rules, $messages);
if($validator->fails()) {
return redirect()->back()->widthErrors($validator);
}
else {
dd('heya');
}
When i sumbmit the form this message appears:
ErrorException in FileLoader.php line 109: Array to string conversion
Someone knows why, and how do i solve it?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire