Answer the question
In order to leave comments, you need to log in
How to send file directly to cURL PHP object storage?
Good afternoon.
From the form, the file is uploaded to the server (ajax), after which it is uploaded to the Selectel object storage (PUT cURL php).
Tell me, is it possible to avoid uploading a file to an intermediate server and upload the file from the form immediately with cURL to the repository?
Thank you!
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.selcdn.ru/v1/SEL_1337/test/Eprtst1.mp4",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => array('
' => new CURLFILE('test/upload/5ec46a241e58b.mp4')),
CURLOPT_HTTPHEADER => array(
"X-Auth-Token: 478493248"
),
));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question