title: File upload using foreach in Laravel
body: <p>Been working on this problem for 2 days and still cannot figure it out.  I am trying to upload multiple files into storage in my Laravel project.  I know my code works up to the foreach as I tested this with dd.    </p>
  
  <p><strong>My controller:</strong></p>
  
  <pre class="lang-php prettyprint-override"><code>$files = $request-&gt;file('current_plan_year_claims_data_file_1');
  $folder = public_path(). "\storage\\$id";
  
  if (!File::exists($folder)) {
      File::makeDirectory($folder, 0775, true, true);
  }
  
  if (!empty($files)) {
      foreach($files as $file) {
          Storage::disk(['driver' =&gt; 'local', 'root' =&gt; $folder])-&gt;put($file-&gt;getClientOriginalName(), file_get_contents($file));
      }
  }
  </code></pre>