1. Go to this page and download the library: Download rootscratch/cloudstorage library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rootscratch / cloudstorage example snippets
use Rootscratch\Cloudstorage\Configuration;
// Set configuration values
Configuration::setEndpoint("https://your_end_point.r2.cloudflarestorage.com");
Configuration::setBucketName("bucket_name");
Configuration::setAccessKey("access_key");
Configuration::setSecretKey("secrey_key");
new Configuration();
use Rootscratch\Cloudstorage\UploadFile;
$cloud_upload = new UploadFile();
$upload_file = $cloud_upload->uploadFile($_FILES['test'], null, null);
echo json_encode($upload_file, JSON_PRETTY_PRINT);
use Rootscratch\Cloudstorage\DeleteFile;
$cloud_delete = new DeleteFile();
$delete_file = $cloud_delete->deleteFile('filename.png', null);
echo json_encode($delete_file, JSON_PRETTY_PRINT);