title: Guzzle 6: upload files with array data
body: <p>I have to send array data with files. Using just data work properly:</p>
  
  <pre><code>$client-&gt;post('http://xxx/', [
      'form_params' =&gt; [
          [
              'data' =&gt; ['id' =&gt; 1234, 'name' =&gt; 'nombre'],
              'valid' =&gt; true
          ]
      ]
  ]);
  </code></pre>
  
  <p>But since I can't use "form_params" with "multipart", how can send files with arrays and boolean data?</p>
  
  <p>I've tried:</p>
  
  <pre><code>$client-&gt;post('http://xxx/', [
      'multipart' =&gt; [
          [
              'name'     =&gt; 'myfile',
              'contents' =&gt; fopen('my_file.txt', 'r'),
          ],
          [
              'name'     =&gt; 'data',
              'contents' =&gt; ['id' =&gt; 1234, 'name' =&gt; 'nombre'],
          ]
          [
              'name'     =&gt; 'valid',
              'contents' =&gt; true,
          ]
      ],
  ]);
  </code></pre>
  
  <p>but I get a error since "contents" doesn't accept boolean or array values.</p>
  
  <p>I need some help.</p>
  
  <p>Thanks </p>
  
  <p><strong>Update</strong>:
  I couldn't solve the problem and finally I had to user a not very nice solution, including as query string the form filed parameter and using just Multipart. Something like:</p>
  
  <pre><code>$client-&gt;post('http://xxx?id=1234&amp;name=nombre', [
  'multipart' =&gt; [
      [
          'name'     =&gt; 'myfile',
          'contents' =&gt; fopen('my_file.txt', 'r'),
      ],
  ],
  </code></pre>
  
  <p>]);</p>