1--TEST-- 2curl_copy_handle() allows to post CURLFile multiple times with curl_multi_exec() 3--SKIPIF-- 4<?php include 'skipif.inc'; ?> 5--FILE-- 6<?php 7include 'server.inc'; 8$host = curl_cli_server_start(); 9 10$ch1 = curl_init(); 11curl_setopt($ch1, CURLOPT_SAFE_UPLOAD, 1); 12curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=file"); 13// curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1); 14 15$filename = __DIR__ . '/АБВ.txt'; 16file_put_contents($filename, "Test."); 17$file = curl_file_create($filename); 18$params = array('file' => $file); 19var_dump(curl_setopt($ch1, CURLOPT_POSTFIELDS, $params)); 20 21$ch2 = curl_copy_handle($ch1); 22$ch3 = curl_copy_handle($ch1); 23 24$mh = curl_multi_init(); 25curl_multi_add_handle($mh, $ch1); 26curl_multi_add_handle($mh, $ch2); 27do { 28 $status = curl_multi_exec($mh, $active); 29 if ($active) { 30 curl_multi_select($mh); 31 } 32} while ($active && $status == CURLM_OK); 33 34curl_multi_remove_handle($mh, $ch1); 35curl_multi_remove_handle($mh, $ch2); 36curl_multi_remove_handle($mh, $ch3); 37curl_multi_close($mh); 38?> 39===DONE=== 40--EXPECT-- 41bool(true) 42АБВ.txt|application/octet-stream|5АБВ.txt|application/octet-stream|5===DONE=== 43--CLEAN-- 44<?php 45@unlink(__DIR__ . '/АБВ.txt'); 46?> 47