-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
39 lines (23 loc) · 875 Bytes
/
test.php
File metadata and controls
39 lines (23 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require_once __DIR__ . '../vendor/autoload.php';
if (!isset($_FILES['test'])) {
echo 'No Files Detected';
}
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");
// Create an instance
new Configuration();
// Upload File
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);
//Delete File
use Rootscratch\Cloudstorage\DeleteFile;
$cloud_delete = new DeleteFile();
$delete_file = $cloud_delete->deleteFile('filename.png', null);
echo json_encode($delete_file, JSON_PRETTY_PRINT);