Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

File Upload Bundle Laravel Package

connectholland/file-upload-bundle

View on GitHub
Deep Wiki
Context7

FileUploadBundle

File Upload integration for Symfony 2.4+ and 3+.

Installation using Composer

Run the following command to add the package to the composer.json of your project:

$ composer require connectholland/file-upload-bundle

Enable the bundle

Enable the bundle in the kernel:

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new ConnectHolland\FileUploadBundle(),
        // ...
    );
}

Usage

1. Configure the FileUploadBundle for file uploads

The bundle requires a location to store the file uploads. Configure the location with the existing FileUploadBundle configuration in your config.yml file:

# app/config/config.yml

file_upload:
    path: "%kernel.root_dir%/../../some-directory-outside-of-the-project/%kernel.environment%"

2. Modify your Doctrine entity class

To activate file uploads for a Doctrine entity you need to implement the UploadObjectInterface and add getters and setters for the form fields.

For ease of use the FileUploadBundle provides an UploadTrait to implement both the interface and the getters and setters:

namespace AppBundle\Entity;

use ConnectHolland\FileUploadBundle\Model\UploadObjectInterface;
use ConnectHolland\FileUploadBundle\Model\UploadTrait;

class Entity implements UploadObjectInterface
{
    use UploadTrait {
        getFileUpload as getImageUpload;
        setFileUpload as setImageUpload;
        getFileUpload as getAnotherImageUpload;
        setFileUpload as setAnotherImageUpload;
    }
}

In the above example you see the UploadTrait with getters and setters for two file upload fields implemented. Here the getImageUpload method maps to a field called 'image' and getAnotherImageUpload maps to 'another_image'.

Credits

License

This package is licensed under the MIT License. Please see the LICENSE file for details.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor