title: Upload image to database in laravel 5 using eloquent ORM?
body: <p>I have one form which contains one file upload.</p>
  
  <p>Form Id is "upload_form"</p>
  
  <pre><code>&lt;input type="file" id="image" name="image"/&gt;
  </code></pre>
  
  <p>Using javascript onclick function and ajax to pass the image to the controller.</p>
  
  <p>Ajax fn:</p>
  
  <pre><code>$.ajax({
  url: 'UploadImage',
  data:new FormData($("#upload_form")[0]),
  type: "post",
  dataType:"JSON",
  async:false,
  
  success: function (data) {
  
  console.log(data);
  
        }
  });
  }
  </code></pre>
  
  <p>Routes:</p>
  
  <pre><code>Routes::post('UploadImage','UploadController@Upload');
  </code></pre>
  
  <p>UploadController:</p>
  
  <pre><code>public function Upload()
  {
   $file = Input::file('image');
   $tmpFilePath = '/temp/uploads/';
   $tmpFileName = time() . '-' . $file-&gt;getClientOriginalName();
   $path = $tmpFilePath.$tmpFileName;
   $data_file = $file-&gt;move(public_path() . $tmpFilePath, $tmpFileName);
   // Error for move() and getClientOriginalName() functions.
  
  }
  </code></pre>