Developed with love by KnpLabs Hire us for your project!
0

file-uploader-bundle

by intaro

Simplifies file uploading in Symfony2

File Uploader Bundle

About

This is Symfony2 bundle. The purpose of this bundle is to simplify the file uploading process.
It moves files to storage after they were uploaded into temporary folder.

There are few supported storage types:
- local filesystem
- amazon s3

Installation

Require the bundle in your composer.json file:

  {
      "require": {
          "intaro/file-uploader-bundle": "dev-master",
      }
  }

Register in AppKernel:

  // app/AppKernel.php

  class AppKernel extends SaasKernel
  {
      public function registerBundles()
      {
          $bundles = array(
              ...
              new Intaro\FileUploaderBundle\IntaroFileUploaderBundle(),
          );
      }
  }

Install with composer:

$ composer update intaro/file-uploader-bundle

Usage

In config:
``` yml
# app/config/config.yml

intaro_file_uploader:
uploaders:
local:
image:
path: http://www.app.local/images/
create: true
allowed_types: ['image/jpeg', 'image/png', 'image/gif']
document:
directory: path/to/another/attach/dir
create: true
allowed_types: ['application/pdf', 'application/rtf', 'application/vnd.ms-office']
aws_s3:
video:
service_id: aws.client_service_name
path: https://s3-us-west-2.amazonaws.com/bucket-name/iamges/
bucket_name: some_bucket
options:
create: true
acl: public-read
```

In code:
```php

public function uploadAction()
{
$files = $this->getRequest()->files->get('file');

  $this->get('intaro.video_uploader')->upload($file);

}

The MIT License (MIT)

Copyright (c) 2014 Intaro Soft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
intaro_file_uploader:
uploaders:
local:

# Prototype
name:
allowed_types: []
directory: ~
path: ~
create: ~
aws_s3:

# Prototype
name:
allowed_types: []
bucket_name: ~
service_id: ~
path: ~
options:
directory: ~
create: ~
acl: ~