title: Sending numerous files via HTTP POST & curl
body: <p><strong>Problem :</strong></p>
  
  <p>I am having difficulty with reliably sending numerous files via HTTP Post from one web server to another.</p>
  
  <p>I've noticed the success of files being transferred over is dependent on the size and amount of files I choose to send.</p>
  
  <p>What I constitute as a successful transfer is if all files sent from the source server appear in the directory of the receiving server.</p>
  
  <pre><code>//sender script
  
  $ch = curl_init();
  
  $data = array(
      'file1' =&gt; '@/var/www/html/uploadtest/largerfile.zip',
      'file2' =&gt; '@/var/www/html/uploadtest/largerfile.zip',
      'file3' =&gt; '@/var/www/html/uploadtest/smallerfile.zip'
  );
  
  curl_setopt($ch, CURLOPT_URL, 'http://domain.com/test/reciever.php');
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
  curl_setopt($ch, CURLOPT_TIMEOUT, 60);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  
  $res = curl_exec($ch);
  
  if(curl_exec($ch)){
      print "Error: " . curl_error($ch);
  }
  
  echo $res;
  
  //recieving script
  
  print_r($_FILES); //outputs as blank array on failed transfer
  move_uploaded_file( $_FILES["file1"]["tmp_name"], "file1.zip" );
  move_uploaded_file( $_FILES["file1"]["tmp_name"], "file2.zip" );
  move_uploaded_file( $_FILES["file1"]["tmp_name"], "file3.zip" );
  </code></pre>
  
  <p>With the current files being sent across none of them arrive at their destination. If I remove one <em>largerfile.zip</em> then the file transfer is successful.</p>
  
  <p>I am looking for error responses by printing <em>$res</em> but I don't see any despite a failed transfer. *curl_errno* also does not detect anything.</p>
  
  <p><strong>Background :</strong></p>
  
  <p>I've been recommended to use FTP previously but the Web API I'll be using only accepts POST. It's also likely that the files I need to transfer are around 50mbs. </p>
  
  <p>I've also tried changing the following php.ini settings to :</p>
  
  <ul>
  <li>post_max_size : 100M</li>
  <li>upload_max_size : 60M</li>
  </ul>