title: Laravel - Update Uploaded Files in Input File
body: <p>I want  to update my uploaded images, but as soon as I update 1 image the other images are removed why is that? I want to left them as what they are when they had been upload. help me please thanks.</p>
  
  <p><a href="https://i.stack.imgur.com/f4mRr.png" rel="nofollow noreferrer">Here is an image of the problem</a></p>
  
  <p><strong><em>Controller</em></strong></p>
  
  <p>Update, public function, here is where I put the logic of the code</p>
  
  <pre><code>public function update(Request $request, $id)
  {
      $this-&gt;validate($request, [
          'title' =&gt; 'required',
          'description' =&gt; 'required',
          'fleet_image.*' =&gt; 'image|nullable|max:1999'
      ]);
      $fleet = [];
      if ($request-&gt;has('fleet_image'))
      {   
          //Handle File Upload
  
  
          foreach ($request-&gt;file('fleet_image') as $key =&gt; $file)
          {
              // Get FileName
              $filenameWithExt = $file-&gt;getClientOriginalName();
              //Get just filename
              $filename = pathinfo( $filenameWithExt, PATHINFO_FILENAME);
              //Get just extension
              $extension = $file-&gt;getClientOriginalExtension();
              //Filename to Store
              $fileNameToStore = $filename.'_'.time().'.'.$extension;
              //Upload Image
              $path = $file-&gt;storeAs('public/fleet_images',$fileNameToStore);
              array_push($fleet, $fileNameToStore);
          }
  
          $fileNameToStore = serialize($fleet);
      }
      else
      {
          $fileNameToStore='noimage.jpg';
      }
  
  
      if (count($fleet)) {
          foreach ($fleet as $key =&gt; $value) {
          $fleetContent = Fleet::find($id);
          $fleetContent-&gt;title = $request-&gt;title[$key];
          $fleetContent-&gt;description = $request-&gt;description[$key];
          $implodedFleet = implode(' , ', $fleet);
          if($request-&gt;hasFile('fleet_image')){
         $fleetContent-&gt;fleet_image = $implodedFleet;
          }
         $fleetContent-&gt;save();
         return redirect('/admin/airlineplus/fleets')-&gt;with('success', 'Content Updated');
      }
  
  }
  return redirect('/admin/airlineplus/promotions')-&gt;with('success', 'Content Updated');
  
  
  }
  </code></pre>
  
  <p><strong><em>View, edit.blade.php</em></strong></p>
  
  <pre><code>  {!! Form::open(['action'=&gt;['Admin\FleetsController@update',$fleet-&gt;id], 'method' =&gt; 'POST','enctype'=&gt;'multipart/form-data', 'name' =&gt; 'add_name', 'id' =&gt; 'add_name']) !!}
  
          &lt;div class="table-responsive"&gt;
            &lt;table class="table table-bordered" id="dynamic_field"&gt;
              &lt;tr&gt;
                &lt;td&gt;   {{Form::text('title[]', $fleet-&gt;title, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Enter a Title', 'id'=&gt;"exampleFormControlFile1"])}}&lt;br&gt;
  
                  {{Form::textarea('description[]', $fleet-&gt;description, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Enter a Description'])}} &lt;br&gt;
                  &lt;div class="card card-body col-md-8"&gt;
  
                  @foreach(explode(' , ' ,$fleet-&gt;fleet_image) as $content)
                    &lt;img src="{{ asset('storage/fleet_images/' . $content) }}" style="width:50px;height:50px;"&gt;&lt;br/&gt;
  
                    {{ Form::file('fleet_image[]',['id'=&gt;'exampleFormControlFile1']) }}&lt;br/&gt;
                    @endforeach 
                  &lt;/div&gt;
               &lt;/td&gt;
  
              &lt;/tr&gt;
            &lt;/table&gt;
            {{Form::hidden('_method', 'PUT')}}
            {{Form::submit('submit', ['class'=&gt;'btn btn-primary', 'name'=&gt;'submit'])}}
          &lt;/div&gt;
      {!! Form::close() !!}
  </code></pre>