我需要附加一些文件,并使用laravel 5.7中的表单提交功能将其保存到.pdf和.jpeg之类的表中 这是我的文件附加表单组
<div class="form-group row">
<label for="inputPassword" class="col-sm-2 col-form-label">CV</label>
<div class="col-sm-10">
<input type="file" class="form-control-file" id="exampleFormControlFile1" name="file">
</div>
</div>
控制器就是这样
public function store(Request $request)
{
$datas = New Data;
$datas->job = $request->input('job');
$datas->name = $request->input('name');
$datas->expe = $request->input('exp');
$datas->salary = $request->input('salary');
$datas->file = $request->input('file');
$datas->save();
return redirect()->back()->with('info','Your Job has been saved sucessfully');
}
但是当我提交表单以保存文件时出现以下错误消息
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'file' cannot be null
我该如何解决这个问题?