0
我想使用自舉的FileInput插件在laravel項目 這裏上傳的輪廓圖像視圖Laravel 5.4 |如何使用bootstrap fileinput上傳圖片?
@section('content')
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;">
<img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&text=no+image" alt="" /> </div>
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;"> </div>
<div>
<span class="btn default btn-file">
<span class="fileinput-new"> Select image </span>
<span class="fileinput-exists"> Change </span>
<input type="file" name="..."> </span>
<a href="javascript:;" class="btn red fileinput-exists" data-dismiss="fileinput"> Remove </a>
</div>
</div>
@endsection
的目標是將這一圖片上傳到存儲目錄並存儲在數據庫到文件的路徑表,但我不知道如何做到這一點,我通過POST提交表單到我的控制器中的商店方法。 下面是功能
public function store(Request $request)
{
//
$this->validate($request, [
'first_name' => 'required',
'dob' => 'required',
'mobile_no' => 'unique:customers',
'adhar_no' => 'unique:customers',
]);
$customer = new customer;
$customer->first_name = $request->first_name;
$customer->last_name = $request->last_name;
$customer->gender = $request->gender;
$customer->dob = $request->dob;
$customer->mobile_no = $request->mobile_no;
$customer->adhar_no = $request->adhar_no;
$customer->street = $request->street;
$customer->save();
return redirect('home/customer');
}
請幫