PHP code example of sidus / file-upload-bundle

1. Go to this page and download the library: Download sidus/file-upload-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/ */

    

sidus / file-upload-bundle example snippets




class AppKernel
{
    /**
     * {@inheritdoc}
     */
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Oneup\UploaderBundle\OneupUploaderBundle(),
            new Oneup\FlysystemBundle\OneupFlysystemBundle(),
            new Sidus\FileUploadBundle\SidusFileUploadBundle(),
            // ...
        ];
        // ...
    }
}



namespace MyNamespace\AssetBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Sidus\FileUploadBundle\Entity\Resource;

/**
 * @ORM\Entity(repositoryClass="Sidus\FileUploadBundle\Entity\ResourceRepository")
 */
class Document extends Resource
{
    /**
     * @return string
     */
    public static function getType()
    {
        return 'document'; // Must match your mapping key
    }
}



class AppKernel
{
    /**
     * {@inheritdoc}
     */
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Sidus\BaseBundle\SidusBaseBundle(),
            new Sidus\BaseSerializerBundle\SidusBaseSerializerBundle(),
            // Then the one documented in the install process
            new Oneup\UploaderBundle\OneupUploaderBundle(),
            new Oneup\FlysystemBundle\OneupFlysystemBundle(),
            new Sidus\FileUploadBundle\SidusFileUploadBundle(),
            // ...
        ];
        // ...
    }
}
yml
sidus_file_upload:
    enable_serializer: true