0
I have the following code:
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="img">
</fieldset>
</form>
Controllerpost:
use Validator;
....
$rules = array('img' => 'image|max:1024*1024');
$messages = array(
'img.image' => 'Só pode ser uma imagem (jpg, gif ou png)',
'img.max' => 'ficheiro muito pesado... upload máximo é 1 MB'
);
$validator = Validator::make($request->all(), $rules, $messages);
if($validator->fails()) {
return redirect()->back()->withErrors($validator);
}
else {
dd('heya');
}
When I upload the file the following message appears:
Errorexception in Fileloader.php line 109: Array to string Conversion
Someone why and how to solve?
widthErrors or withErrors? Let’s start doing this little fix.
– Wallace Maxters
What is the 109 line? the error basically says, that you tried to manipulate an array with a scalar function.
– rray