title: how to send multiple files with one key in laravel using guzzle Http
body: <p>I can send multiple files and string data with post man like bellow:</p>
  <p><a href="https://i.stack.imgur.com/NwmLF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NwmLF.png" alt="enter image description here" /></a></p>
  <p>but the question is how to send similar request with laravel http ?</p>
  <p>what I did is :</p>
  <pre><code>
  public function performMultiPartRequest($requestUrl, $body)
      {
          $response = Http::withHeaders(['Accept' => 'application/json']);
          $data = [];
          foreach ($body as $key => $value) {
              if (gettype($value) == 'string') // for string data. works well.
                  array_push($data,[$key, $value]);
              else if (gettype($value) == 'array') { // array of files. doesn't work!
                  foreach ($value as $file) {
                      $extension = $file->getClientOriginalExtension();
                      $response->attach($key , fopen($file, 'r'), mt_rand(100,1000).".".$extension);
                  }
              }
              else { // one file. works well.
                  $extension = $value->getClientOriginalExtension();
                  $response->attach($key, fopen($value, 'r'), 'temp.'.$extension);
              }
          }
          $response = $response->post($this->baseUri.$requestUrl, $body);
          return $response;
  
      }
  </code></pre>
  <p>when I try to send some string key value with a file or files with different keys, it's ok, but when I try to send data with multiple file upload (one key) error happens.</p>
  <p>the error message is:
  <code>A 'contents' key is required</code> with status code 0</p>