kematjaya / upload-bundle
Installs: 1 883
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- doctrine/doctrine-bundle: ^2.3
- doctrine/orm: ^2.10|^3.0
- kematjaya/upload: ^7.0
- minwork/array: ^1.13
- symfony/doctrine-bridge: ^6.0|^7.0
- symfony/event-dispatcher: ^6.0|^7.0
- symfony/form: ^6.0|^7.0
- symfony/framework-bundle: ^6.0|^7.0
- symfony/http-foundation: ^6.0|^7.0
- symfony/mime: ^6.0|^7.0
- symfony/options-resolver: ^6.0|^7.0
- symfony/routing: ^6.0|^7.0
- symfony/translation: ^6.0|^7.0
- symfony/twig-bundle: ^6.0|^7.0
- symfony/uid: ^6.0|^7.0
- symfony/yaml: ^6.0|^7.0
Requires (Dev)
- phpunit/phpunit: ^9.6
- symfony/browser-kit: ^6.0|^7.0
- symfony/var-dumper: ^6.0|^7.0
This package is auto-updated.
Last update: 2024-10-24 08:11:00 UTC
README
- installation
composer require kematjaya/upload-bundle
- add to bundles.php
...
Kematjaya\UploadBundle\UploadBundle::class => ['all' => true]
...
- Update schema database
php bin/console doctrine:schema:update --force
- import route
## config/routes/annotations.yaml
...
upload:
resource: '@UploadBundle/Resources/routes/all.yml'
...
- Set Upload directory
// config/packages/upload.yaml
upload:
uploads_dir: '%kernel.project_dir%/public/uploads'
- use KmjFileType in form
...
use Kematjaya\UploadBundle\Type\KmjFileType;
...
...
public function buildForm(FormBuilderInterface $builder, array $options)
{
...
$builder->add('attachment', KmjFileType::class, [
'label' => 'attachment'
]);
// or add additional directory inside upload dir
$builder->add('attachment', KmjFileType::class, [
'label' => 'attachment',
'additional_path' => 'foo'
]);
...
}
- update your database schema
php bin/console doctrine:schema:update --force
- add form theme in config/packages/twig.yml
twig:
form_themes: [
'@Upload/fields.html.twig',
......
]