title: Laravel uploading multiple files and returning list of filename in controller
body: <p>I want to upload multiple files in selecting file option</p>
  <p><strong>HTML:</strong></p>
  <pre><code>                     &lt;div class=&quot;input-group form-group&quot;&gt;
                       &lt;div class=&quot;custom-file form-group&quot;&gt;
                           &lt;input id=&quot;logo&quot; type=&quot;file&quot; class=&quot;custom-file-input form-control&quot; name=&quot;bankfile&quot; accept=&quot;application/pdf&quot; required&gt;
                           &lt;label for=&quot;logo&quot; class=&quot;custom-file-label&quot;&gt;&lt;/label&gt;
                       &lt;/div&gt; 
  
  
  </code></pre>
  <p>AND return list / array of filename in <code>filename</code>
  <strong>PATH:</strong>
  <code>Http/Controllers/statementController.php</code></p>
  <p><strong>CONTROLLER:</strong></p>
  <pre><code>           public function index(Request $request)
      {
          try 
          {
              @$bankname = $request-&gt;bankname;
              @$password = $request-&gt;password;
              @$analytics_id = $request-&gt;analytics_id;
  
              if(@$analytics_id==null)
              {
                  @$analytics_id = session('analytics_id');
  
              }
              
              @$file = $request-&gt;file('bankfile');
  
              function random_strings($length_of_string) 
              { 
                  // String of all alphanumeric character 
                  $str_result = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; 
                  // Shufle the $str_result and returns substring 
                  // of specified length 
                  return substr(str_shuffle($str_result),0, $length_of_string); 
              } 
  
              @$job_id = random_strings(20); 
  
              @$filenamePre = $file-&gt;getClientOriginalName();
              @$path_parts = pathinfo($filenamePre);
              @$extension =  $path_parts['extension'];
              @$filename=@$analytics_id.'-'.@$bankname.'-'.@$job_id.'.'.$extension;
              
              @$file-&gt;move(base_path().'/storage/app/public/bks/case_1/', $filename); 
  
              // analytics::dispatch($job_id,$analytics_id,$bankname,$filename,$password)-&gt;delay(now()-&gt;addSeconds(3));
  
              DB::select('insert into analytics_job set descr=?,analytics_user_id=?',[$job_id,$analytics_id]);
              DB::select('insert into analytics_report set analysis_user_id=?,    job_id=?,filename=?,password=?,bankname=?',[$analytics_id,$job_id,$filename,$password,$bankname]);
  
              @$data = array('job_id' =&gt; @$job_id, 'analytics_id' =&gt; @$analytics_id, 'bankname' =&gt; @$bankname , 'filename' =&gt; @$filename, 'password' =&gt; @$password);
  
              @$result = $this-&gt;analyticsData(@$data);
              @$resultJson = json_decode(@$result);
              if(@$resultJson-&gt;code==200)
              {
  
              }
  
      
              return redirect('/analytics/dashboard');
          } 
          catch (Exception $e) 
          {
              
          }
      }
  
  </code></pre>
  <p>Following Error:</p>
  <pre><code>Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
  Call to a member function getClientOriginalName() on null
  </code></pre>