title: multi image post laravel rest api
body: <pre><code>  public function store(Request $request)
  {
      if (!$request-&gt;hasFile('avatar')) {
          return response()-&gt;json(['upload_file_not_found'], 400);
      }
  
      $allowedfileExtension = ['pdf', 'jpg', 'png'];
      $files = [];
      $files[] = $request-&gt;file('avatar');
      // dd($files);
      $errors = [];
  
      foreach ($request-&gt;file('avatar') as $file) {
          var_dump($file-&gt;getClientOriginalExtension);
          $extension = $file-&gt;getClientOriginalExtension();
  
          $check = in_array($extension, $allowedfileExtension);
  
          if ($check) {
              foreach ($request-&gt;fileName as $mediaFiles) {
  
                  $path = $mediaFiles-&gt;store('public/product');
                  $name = $mediaFiles-&gt;getClientOriginalName();
  
                  //store image file into directory and db
                  $save = new Image();
                  $save-&gt;title = $name;
                  $save-&gt;path = $path;
                  $save-&gt;save();
              }
          } else {
              return response()-&gt;json(['invalid_file_format'], 422);
          }
  
          return response()-&gt;json(['file_uploaded'], 200);
      }
      return &quot;cloese&quot;;
  }
  </code></pre>
  <ul>
  <li></li>
  </ul>
  <p>I'm building a rest api with a multi image upload feature. I'm using laravel veris 9. here I'm having problems doing multiimage uploads because the image data is not captured from my request
  *</p>