curious-inc / file-upload-form-type-bundle
Helper bundle for mapping Dropzone.js frontend to Symfony FormType using File entity
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 324
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 6
Forks: 1
Open Issues: 4
Type:symfony-bundle
Requires
- doctrine/orm: ~2.4
- knplabs/doctrine-behaviors: ~1.1
- nelmio/api-doc-bundle: ^3.0
- oneup/uploader-bundle: ~2.0
- symfony/form: ^4.0
- twig/twig: ~2.1
This package is not auto-updated.
Last update: 2022-03-23 08:51:18 UTC
README
Helper bundle for mapping Dropzone.js frontend to Symfony FormType using File entity
This bundle was heavily inspired by sopinet/UploadFilesBundle.
Installation
Installing prerequisites
Make sure you have Oneup\UploaderBundle installed and configured
before you proceed.
See their documentation for
setting up this bundle.
Note: Make sure you enable orphanage management by setting the use_orphanage
configuration setting to true
.
Installing the bundle
Use composer to install the bundle
$ composer require curious-inc/file-upload-form-type-bundle
Registering the bundle in AppKernel
Register both OneUp/Uploader bundle and this bundle in AppKernel
// app/AppKernel.php $bundles = [ ... new Oneup\UploaderBundle\OneupUploaderBundle(), new CuriousInc\FileUploadFormTypeBundle\CuriousIncFileUploadFormTypeBundle(), ... ]
Configuring the bundle
Routing configuration
Edit your applications routing configuration
# /app/config/routing.yml ... # Routing for CuriousInc FileUploadFormType bundle curious_file_upload: resource: '@CuriousIncFileUploadFormTypeBundle/Resources/config/routing.yml' ...
Bundle configuration
Edit your applications configuration file to reflect the following changes
Form configuration
# /app/config/config.yml ... # Map template to FormType twig: form_themes: - 'CuriousIncFileUploadFormTypeBundle:Form:file.html.twig' ...
Form configuration for SonataAdmin (if applicable)
# /app/config/config.yml ... # Sonata DoctrineOrmAdmin template overrides sonata_doctrine_orm_admin: templates: types: list: dropzone: '@CuriousIncFileUploadFormTypeBundle:Admin:file.html.twig' ... show: dropzone: '@CuriousIncFileUploadFormTypeBundle:Admin:file.html.twig' ... ...
OneUp/UploaderBundle configuration
# app/config/config.yml ... # Configuration for oneup/uploader-bundle oneup_uploader: mappings: gallery: frontend: 'dropzone' use_orphanage: true namer: curious_file_upload.file_namer # needed storage: directory: '%kernel.project_dir%/web/uploads/gallery' ...