Skip to content

Latest commit

 

History

History
134 lines (106 loc) · 3.1 KB

index.md

File metadata and controls

134 lines (106 loc) · 3.1 KB

YouweFileManagerBundle

Requirements

This bundle requires the FOS Routing Bundle

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require youwe/file-manager-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Youwe\FileManagerBundle\YouweFileManagerBundle(),
        );

        // ...
    }

    // ...
}

Add the bundle in the the assetic config:

# Assetic Configuration
assetic:
    #...
    bundles:        [ YouweFileManagerBundle, ... ]
    #...

Step 3: Set the config

Default Configuration:

youwe_file_manager:
    upload_path: %kernel.root_dir%/../web/uploads
    full_exception: false
    theme:
        css: "/bundles/youwefilemanager/css/simple/default.css"
        template: "YouweFileManagerBundle:FileManager:file_manager.html.twig"
    mime_allowed:
        - 'image/png'
        - 'image/jpg'
        - 'image/jpeg'
        - 'image/gif'
        - 'application/pdf'
        - 'application/ogg'
        - 'video/mp4'
        - 'application/zip'
        - 'multipart/x-zip'
        - 'application/rar'
        - 'application/x-rar-compressed'
        - 'application/x-zip-compressed'
        - 'application/tar'
        - 'application/x-tar'
        - 'text/plain'
        - 'text/x-asm'
        - 'application/octet-stream'

Optional config:

  • theme
    You can define your own css and template here.
  • full_exceptions
    If true, display the exception in the error modal.
    When you leave it false, it will not show the full error for security reasons.
    You don't want to give an user all the information, like the full upload path, when something went wrong.

Step 4: Add the route

Add the route to the routing.yml

youwe_file_manager:
    resource: "@YouweFileManagerBundle/Resources/config/routing.yml"
    options:
        expose: true

CKEditor

Set the route and the route parameters in the ckeditor config

// Example for Ivory CKEditor Bundle
$form = $this->createFormBuilder()
            ->add('content', 'ckeditor', array(
                'config' => array(
                    'filebrowser_image_browse_url' => array(
                        'route'            => 'youwe_file_manager_list',
                        'route_parameters' => array('popup'=>'1'),
                    ),
                ),
            ))->getForm();