Set default value in input type file [duplicate] Set default value in input type file [duplicate] laravel laravel

Set default value in input type file [duplicate]


Due to browser's security, You cannot just put default value to file input.

The better way is to check if the user selected a file before updating your records.

So on your update function:

public function update(){    // Make sure you didn't required the user to select file.    $attribute = [        'name' => $request->name,        'order' => $request->order    ]    if($request->hasFile('pathheader')){        //If user select a file, upload the file         //Then you should update your record by         //adding fields to your update attribute.         $attribute['pathheader'] => $pathheader;    }    //otherwise, no changes will happen to your 'pathheader' column.    DB::table('yourtable')->where('id',$id)->update($attribute);}