trying to make a photo upload but It gives me the following error, even though it worked a while back! what is should I change? I am using larval 5.4
FatalThrowableError Call to a member function getClientOriginalName() on null
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
public function uploadPhoto(Request $request){
$file = $request->file('pic');
$filename = $file->getClientOriginalName();
$path ='public/img';
$file->move($path,$filename);
$user_id = Auth::user()->id;
DB::table('users')->where('id',$user_id)->update(['pic' => $filename]);
return back();
}
}