title: how to send Request Payload with php cURL?
body: <p>how to send Request Payload with php cURL?</p>
  
  <p>I'm trying to upload a file to a server that hosts files for free, and when sending the file to curl not I accept it and I redirected to an error page, and when I do it from your Interfas I can see how the files are sent in code inspector</p>
  
  <p>How should I set cURL php for the file server receives me this way as if the browser?</p>
  
  <p><strong>Request Payload</strong></p>
  
  <p>------WebKitFormBoundary0cHZePmuSA0mtcdO</p>
  
  <p>Content-Disposition: form-data; name="files[]"; filename="vlcsnap-2015-07-17-22h57m13s909.png"
  Content-Type: image/png</p>
  
  <p>------WebKitFormBoundary0cHZePmuSA0mtcdO--</p>
  
  <pre><code>$ch = curl_init();
  
  $ch_file = new CURLFile( $tmp_name, $type, $name );
  $data = array("files[]"=&gt;$ch_file);
  
  curl_setopt($ch, CURLOPT_URL, "http://url_site.com");
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  
  $response = curl_exec($ch);
  </code></pre>