title: How to upload multiple images into a database using laravel?
body: <p>I am trying to Upload multiple images into a database but only one is uploading instead of multiple.</p>
  
  <p>How to upload multiple images into a database?</p>
  
  <p>Could anyone tell me what is wrong with my code?</p>
  
  <pre><code>        [database table ][1]
          [1]: https://i.stack.imgur.com/kgv4r.png  
  </code></pre>
  
  <p><strong>controller</strong></p>
  
  <pre><code>public function singalprojectaction(Request $request)
    {
     $input=$request-&gt;all();
     $images=array();
     if($files=$request-&gt;file('images')){
     foreach($files as $file){
     $name=$file-&gt;getClientOriginalName();
     $file-&gt;move(public_path('projects'), $name);
     $images[]=$name;
     }
     }
     $query=DB::table('single_portfolio')-&gt;insert( [
    'Project_name' =&gt;$input['project_name'],
    'Client_Name' =&gt;$input['Client_name'],
    'Completion_date' =&gt;$input['Completion_date'],
    'Duration' =&gt;$input['Duration'],
    'project_image_one'=&gt;  implode("|",$images),
    'Description' =&gt;$input['Description'],
     'project_id' =&gt;$input['select_project'],
     ]);
    if($query)
     {
     return response()-&gt;json([
    'message'   =&gt; 'Image is Successfully Inserted',
    'class_name'  =&gt; 'alert-success'
    ]);
     }
    else{
  
   return response()-&gt;json([
  'message'   =&gt; 'Data  is not inserted Inserted',
  'class_name'  =&gt; 'alert-warning'
   ]);
  
    }
    }
  </code></pre>
  
  <p><strong>html view</strong> </p>
  
  <pre><code>&lt;form action="Route('singal.action') }}" id="singal_project" 
     enctype="multipart/form-data"&gt;
     {{ csrf_field() }}
     &lt;div class="alert" id="message" style="display:block;"&gt;&lt;/div&gt;
     &lt;div class="group-form"&gt;
        &lt;label&gt;Drop Multple Imges&lt;/label&gt;
        &lt;input required type="file" class="form-control" name="images[]"
           multiple&gt;
     &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>