I need attach some file and save to the table like .pdf and .jpeg using form submition in laravel 5.7 this is my file attach form group
<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>
and controller is like this,
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');
}
but when I submit form to save file following error massage is occured SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'file' cannot be null
how can I fix this problem?
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2YNKz0w
via IFTTT
Aucun commentaire:
Enregistrer un commentaire