Hello,
I want to upload multiple file with Upload via URL api. But i didn’t find any resource. Anyone can help?
I wrote how to send a single file (Laravel / Guzzle), I’m sharing it below.
private function sendImageRequest()
{
$client = new Client();
$accountID = config('app.cloudflare_images.account_id');
$apiToken = config('app.cloudflare_images.api_token');
$response = $client->request('POST',"https://api.cloudflare.com/client/v4/accounts/{$accountID}/images/v1",[
'headers' => [
'Authorization' => "Bearer {$apiToken}",
],
'multipart' => [
[
'name' => 'url',
'contents' => $this->file,
],
[
'name' => 'metadata',
'contents' => $this->metadata ,
],
[
'name' => 'requireSignedURLs',
'contents' => 'false',
],
],
]);
$responseBody = $response->getBody()->getContents();
$data = json_decode($responseBody, true);
$this->response = $data;
return $this;
}