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