title: storing uploaded image into database laravel
body: <p>I am having trouble uploading my image into database, everytime I try to upload it, the data send into the database is empty but my local disk is able to store the image and I don't know what to do. I think I might have done something wrong in the controller part</p>
  
  <p>Controller:</p>
  
  <pre><code>public function store1(Request $request){
  
     $this-&gt;validate($request, [
          'file' =&gt; 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
      ]);
  
  
     if ($request-&gt;hasFile('file')) {
          $image = $request-&gt;file('file');
          $name = $image-&gt;getClientOriginalName();
          $size = $image-&gt;getClientSize();
          $destinationPath = public_path('/images');
          $image-&gt;move($destinationPath, $name);
  
          $userImage = new UserImage;
          $userImage-&gt;name = $name;
          $userImage-&gt;size = $size;
          //dd($userImage);
          $userImage-&gt;save;
  }
  </code></pre>
  
  <p>table that I wanted to upload to:</p>
  
  <pre><code>Schema::create('user_images', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;string('name');
          $table-&gt;string('size');
          $table-&gt;integer('user_id');
          $table-&gt;timestamps();
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/QRayX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QRayX.png" alt="enter image description here"></a></p>