For your curl command, Please try this PHP :
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.sirv.com/v2/files/upload?filename=%2Fpath%2Fto%2Fuploaded-image.jpg');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$post = array(
'file' => '@' .realpath('/path/to/local-file.jpg')
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$headers = array();
$headers[] = 'Authorization: Bearer BEARER_TOKEN_HERE';
$headers[] = 'Content-Type: image/jpeg';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
?>
Please also study the reference provided by Professor Abronsius if you have time. It's worth the effort.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…