I'm trying to upload file with form model binding in laravel 5.2. But it is not working I'm not getting file data in controller.
{!! Form::model($settings, ['route' => ['admin.settings.update', $settings->id], 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'PATCH', 'fiels' => true , 'id' => 'edit-settings']) !!}
<div class="form-group">
{!! Form::file('logo') !!}
</div>
{!! Form::close() !!}
In Controller I've properly imported Input Facades and trying to get file object like this.
$image = Input::all('logo');
OR
$image = Input::file('logo');
But I'm getting name of the file and not total file object.
update your form model like with this, you misspelled the file name
{!!Form::model($settings, ['route' => ['admin.settings.update', $settings->id], 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'PATCH', 'files' => true , 'id' => 'edit-settings']) !!}
then in your controller, do this,
Input::file('logo');
Instead Input::all('logo');
because Input::all();
return all form inputs. so try this one Input::file('logo');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.