here is an example that works fine with php7.3, but not with php7.4.
curl.php
$file='test.txt';
$cfile=curl_file_create($file, mime_content_type($file), 'test.txt');
$post=array('file'=>$cfile);
$ch=curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, 'https://example.com/curl-upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response=curl_exec($ch);
print_r(curl_getinfo($ch));
print_r($response);
if (curl_errno($ch)) {
var_dump(curl_errno($ch));
}
curl-upload.php
echo 'upload';
print_r($_FILES);
$file=file_get_contents('php://input');
print_r($file);
any idea why?
thank you very much!