0
@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
目的は、ストレージディレクトリにこの画像をアップロードして、DB内のファイルへのパスを格納することです私はそれを行う方法を知りません、私は私のコントローラ内のストアメソッドに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');
}
であることが要求からファイルを取得することはとても簡単ですlaravel 5.4で