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
FileLoader:
...
protected function loadPath($path, $locale, $group)
{
if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) { // this is the line 109
return $this->files->getRequire($full);
}
return [];
}
...
Someone knows why, and how do i solve it?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1R1tisY
via IFTTT
Aucun commentaire:
Enregistrer un commentaire