manea-eugen / FileManager

A secure file manager bundle for symfony2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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_exceptions: 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

About

A secure file manager bundle for symfony2

License:MIT License


Languages

Language:JavaScript 64.7%Language:PHP 27.0%Language:CSS 8.3%