PHP code example of vormkracht10 / flysystem-uploadcare

1. Go to this page and download the library: Download vormkracht10/flysystem-uploadcare 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/ */

    

vormkracht10 / flysystem-uploadcare example snippets


[
    'uploadcare' => [
        'driver' => 'uploadcare',
        'public' => env('UPLOADCARE_PUBLIC_KEY'),
        'secret' => env('UPLOADCARE_SECRET_KEY'),
        'cdn' => env('UPLOADCARE_CDN') // Default https://ucarecdn.com
    ]
]

$uuid = Storage::disk('uploadcare')->putGetUuid('example.txt', 'My notes.');

$uuid = Storage::disk('uploadcare')->putFileGetUuid('files', new File('/var/www/uploadcare-app/routes/newcontent.txt'));

$uuid = Storage::disk('uploadcare')->putFileAsGetUuid('files', new File('/var/www/uploadcare-app/routes/newcontent.txt'), 'my-awesome-name.txt');


$contents = Storage::disk('uploadcare')->get('<uuid>');

Storage::disk('uploadcare')->delete('<uuid>');

$mimeType = Storage::disk('uploadcare')->mimeType('<uuid>');

$bytes = Storage::disk('uploadcare')->filesize('<uuid>');

$info = Storage::disk('uploadcare')->fileInfo($result[0]);
$filename = $info->extraMetadata()['originalFilename'];

$files = Storage::disk('uploadcare')->files('0123a456-a0bc-0a1b-0ab1-0a1234a5b6c7~');
foreach ($files as $uuid) {
    echo 'https://ucarecdn.com/' . $uuid .'<br />';
}