I’m trying to send images from my server to cloudflare. I’m using laravel with CURL.
First i request the temp URL, as the docs ask to: https://developers.cloudflare.com/images/upload-images/direct-creator-upload and i get the response, after that i’m trying to make a new CURL request with the image to that url. here is my curl:
$curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, // tmp url provided by cloudflare CURLOPT_RETURNTRANSFER => 1, CURLOPT_TIMEOUT => 30, CURLOPT_POST => true, CURLOPT_POSTFIELDS => ['file'=>new \CURLFile($photo),'image/jpeg','test_name'], CURLOPT_HTTPHEADER => [ "Content-Type: multipart/form-data; boundary=".Str::random(32) ], ]); $response = curl_exec($curl); curl_close($curl); var_dump($response);
but the response i get is:
ERROR 5450: Error while receiving upload,
Can you tell me what is the problem?