1--TEST-- 2curl_copy_handle() allows to post CURLFile multiple times 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"); 13curl_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 23var_dump(curl_exec($ch1)); 24curl_close($ch1); 25 26var_dump(curl_exec($ch2)); 27curl_close($ch2); 28?> 29===DONE=== 30--EXPECTF-- 31bool(true) 32string(%d) "АБВ.txt|application/octet-stream|5" 33string(%d) "АБВ.txt|application/octet-stream|5" 34===DONE=== 35--CLEAN-- 36<?php 37@unlink(__DIR__ . '/АБВ.txt'); 38?> 39