PHP code example of avtonom / media-storage-client-bundle

1. Go to this page and download the library: Download avtonom/media-storage-client-bundle 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/ */

    

avtonom / media-storage-client-bundle example snippets



$bundles(
    ...
    new Sensio\Bundle\BuzzBundle\SensioBuzzBundle(),
    new Avtonom\MediaStorageClientBundle\AvtonomMediaStorageClientBundle(),
    ...
);

 php

public function updateAction(Request $request)
{
    /** @var UploadedFile $file */
    $file = $request->files->get('file');
    if($file instanceof UploadedFile){
    
        $proxyMedia = $this->get('avtonom.media_storage_client.manager')->sendFile($file, $clientName, $context);
    
        return new JsonResponse([
            'media' => $proxyMedia->toArray(),
        ]);
    }
}