I'm trying to upload video to my library on bunny cdn using API but I can't find how to upload it. In their docs you I can't find how to upload the video only create a title for the video but no upload the video its self.
Here is the API request from the docs
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://video.bunnycdn.com/library/libraryId/videos/videoId', [
'headers' => [
'accept' => 'application/json',
],
]);
echo $response->getBody();
I have found here that you have to create a video first and this ok but the part of uploading the video content is not the same. You can see they add a link to the docs but its not the same same as in the image as there is a upload video button in the image but in the docs there isn't.
The Bunny API is really poorly documented, I spent a lot of time figuring out how to make it work:
Let's move forward step by step. First of all we must select the file to upload: below is the html code to do so:
index.html
I also included a progress bar to visually display the upload progress. As you can see there is an onclick action with a javascript function to handle the loading. Also include jQuery to handle the upload
then the function
upload.php
I hope I have been helpful. However with this code I have some problems with files larger than 100Mb. I'm still trying to figure out why.