title: Call to a member function extension() on string
body: <p>I have tried to upload the image using Postman and the image is stored in the preferred directory and the full path is stored in database but i am getting the error response</p>
  
  <p>"message": "Call to a member function extension() on string",</p>
  
  <p>here is my code</p>
  
  <pre><code>public function store(AvatarUploadRequest $request, UserService $userService) {
  $user = $request-&gt;user();
  try {
  
  $file = $request-&gt;file('avatar');
  $file = url("/avatars") . "/" . $user-&gt;uuid . ".jpg";
  $destinationPath = "avatars";
  $user-&gt;avatar = $request-&gt;file('avatar')-&gt;move($destinationPath, $file)
  -&gt;getClientOriginalExtension();
  $user-&gt;avatar = $file;
  $user-&gt;save();
    $userService-&gt;updateAvatar($user, $file);
  } 
  catch (\Exception $e) {
    return jsonApiResponse([
      'avatar' =&gt; $e-&gt;getMessage(),
    ], 422);
  }
  return jsonApiResponseWithData($user, 201);
  </code></pre>
  
  <p>}</p>