title: How to save uploaded file name in table using Laravel 5.1
body: <p>I need help in saving uploaded file name in database table using laravel 5.1.</p>
  
  <p>My Controller code for saving Image details</p>
  
  <pre><code>public function store(Request $request)
  {
     if($request-&gt;hasFile('img_filename'))
     {
         $destinationPath="offerimages";
         $file = $request-&gt;file('img_filename');
         $filename=$file-&gt;getClientOriginalName();
         $request-&gt;file('img_filename')-&gt;move($destinationPath,$filename);
  
     }
  
      $input=$request-&gt;all();
      Offer_image::create($input);
      return redirect('offerimage');
  }
  </code></pre>
  
  <p>My view code for accepting image </p>
  
  <pre><code>{!! Form::open(array('route'=&gt;'offerimage.store','role'=&gt;'form','files'=&gt;true)) !!}
                &lt;div class="box-body"&gt;
  
                  &lt;div class="form-group"&gt;
                    {!! Form::label('img_name','Name') !!}
                    {!! Form::text('img_name', $value = null, $attributes = array('class'=&gt;'form-control','id'=&gt;'img_name','required')) !!}
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                    {!! Form::label('img_description','Description') !!}
                    {!! Form::textarea('img_description', $value = null, $attributes = array('class'=&gt;'form-control','id'=&gt;'img_description','required')) !!}
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                    {!! Form::label('img_filename','Upload Image') !!}
                    {!! Form::file('img_filename') !!}
                  &lt;/div&gt;
  
  
  
                  {!! Form::hidden('status',$value='active') !!}
  
                &lt;/div&gt;&lt;!-- /.box-body --&gt;
  
                &lt;div class="box-footer"&gt;
                  {!! Form::submit('Submit',$attributes=array('class'=&gt;'btn btn-primary')) !!}
                &lt;/div&gt;
                {!! Form::close() !!}
  </code></pre>
  
  <p>This controller code to store image working properly, but where i am trying to save image file name to table , this code is storing filepath to database table.</p>
  
  <p>As I am using direct create() method to store the request object in table, I don't know how do I store file name instead of path.</p>
  
  <p><a href="https://i.stack.imgur.com/VxZd5.jpg" rel="noreferrer">Check this Image for table data</a></p>