title: Sending multipart/form-data via cURL
body: <p>I have the following HTML form:</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" id="upload_form" role="region" action="remoteUpload2.php?command=FileUpload&amp;amp;type=Files&amp;amp;currentFolder=%2F&amp;amp;langCode=en&amp;amp;hash=8e402b8b9927640d&amp;amp;" method="POST" target="ckf_19"&gt;
  &lt;input name="upload" type="file"&gt;
  &lt;input value="Upload Selected File" type="submit"&gt;
  &lt;input name="cancel" value="Cancel" type="button"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When I submit it, if I do a print_r($_FILES) I get the following output:</p>
  
  <pre><code>Array
  (
      [upload] =&gt; Array
          (
              [name] =&gt; logo.png
              [type] =&gt; image/png
              [tmp_name] =&gt; /tmp/phpvIFI0K
              [error] =&gt; 0
              [size] =&gt; 12201
          )
  
  )
  </code></pre>
  
  <p>What I am trying to figure out is how to send a file the same way, using only PHP, to connect two different systems together. I can modify the sending script, but not the receiving script, so I need to send data in the format that is expected.</p>
  
  <p>Is there a way using cURL for me to post data to this script that will result in similar output for $_FILES? I have the file I want to send on the server, I just need to figure out how to POST it to the receiving script.</p>