title: Upload multiple files with curl
body: <p>How do I upload multiple files in an array using <code>CURLFile</code> and <code>curl_setopt</code>?</p>
  
  <p>Using the data array as it would throw an error (can't convert an array to a string) and <code>http_build_query</code> on the data would corrupt the <code>CURLFile</code> objects.</p>
  
  <p>The data I have to upload looks like that:</p>
  
  <pre><code>[
      'mode' =&gt; 'combine',
      'input' =&gt; 'upload',
      'format' =&gt; $outputformat,
      'files' =&gt; [
          [0] =&gt; CURLFile object,
          [1] =&gt; CURLFile object,
          [x] =&gt; ...
      ]
  ]
  </code></pre>