5 months ago

Not working file attachment with Laravel 5.7

Posted 5 months ago by Msoft

I need attach some file and save to the table like .pdf and .jpeg using form submission 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">

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');
        return redirect()->back()->with('info','Your Job has been saved sucessfully');


but when I submit form to save file following error message is occurred SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'file' cannot be null how can I fix this problem?

Please sign in or create an account to participate in this conversation.