1--TEST-- 2CURL file uploading from stream 3--SKIPIF-- 4<?php include 'skipif.inc'; ?> 5<?php 6if (curl_version()['version_number'] < 0x73800) die('skip requires curl >= 7.56.0'); 7--FILE-- 8<?php 9include 'server.inc'; 10$host = curl_cli_server_start(); 11 12$ch = curl_init(); 13curl_setopt($ch, CURLOPT_SAFE_UPLOAD, 1); 14curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc?test=file"); 15curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 16 17$file = curl_file_create('data://text/plain;base64,SSBsb3ZlIFBIUAo=', 'text/plain', 'i-love-php'); 18$params = array('file' => $file); 19var_dump(curl_setopt($ch, CURLOPT_POSTFIELDS, $params)); 20 21var_dump(curl_exec($ch)); 22curl_close($ch); 23?> 24--EXPECT-- 25bool(true) 26string(24) "i-love-php|text/plain|11" 27