kitpages / file-bundle
FileBundle manages uploads and manipulations of files for the Kitpages CMS Bundle
Installs: 27 709
Dependents: 1
Suggesters: 0
Security: 0
Stars: 8
Watchers: 9
Forks: 3
Open Issues: 0
Language:JavaScript
Type:symfony-bundle
Requires
- php: >=5.3.2
- doctrine/doctrine-bundle: ~1.1
- doctrine/orm: ~2.2
- imagine/imagine: ~0.4.1
- kitpages/file-system-bundle: ~3.1
- kitpages/util-bundle: ~3.0
- symfony/framework-bundle: ~2.1
- symfony/monolog-bundle: ~2.1
Requires (Dev)
- beberlei/doctrineextensions: dev-master
- doctrine/doctrine-fixtures-bundle: *
- liip/functional-test-bundle: dev-master
- patchwork/dumper: ~1.2
- phpunit/dbunit: ~1.3.1
- phpunit/phpunit: ~3.7
- symfony/browser-kit: ~2.1
- symfony/class-loader: ~2.1
- symfony/finder: ~2.1
- symfony/yaml: ~2.1
This package is auto-updated.
Last update: 2024-12-04 19:38:01 UTC
README
This is an ajax upload system for symfony.
author : Philippe Le Van (@plv)
Installation
hum... as usual...
put the code in vendors/Kitpages/FileBundle
add vendors/ in the app/autoload.php
add the new Bundle in app/appKernel.php
You need to create a table in the database : launch command: php app/console doctrine:schema:update
Add a field file upload in a form
In form Class $builder->add( 'fileId', 'hidden', array( "label" => "File" ) );
In file Twig
<script type="text/javascript" src="{{ asset ("bundles/kitpagesfile/uploadify/jquery.uploadify.min.js") }}"></script>{% include 'KitpagesFileBundle:Upload:pluginJs.html.twig' ignore missing %}
<form class="standard-form" {{ form_enctype(form) }} method="POST">
<div id="form">
{{ form_row(
form.title
) }}
<div>
<label>Image</label>
{{ form_widget(form.file) }}
{% render 'KitpagesFileBundle:Upload:widget' with {'fieldId': 'form_fileId', 'itemClass': 'AppSiteBundle:Document', 'itemId': form.vars.value.id, parameterList:{'multi': false, 'publishParent': false} } %}
</div>
{{ form_widget(form) }}
</div>
<input type="submit" value="Save"/>
</form>
Attention fieldId = the attribute ID of input generate by "{{ form_widget(form.fileId) }}" in the form
UPDATE DATABASE IF EXISTS
updates an existing database in version1.2.0
Installation ImagineBundle and kitpagesFileSystemBundle
Step1: add the following entries to the deps in the root of your project file:
[Imagine] git=http://github.com/avalanche123/Imagine.git target=imagine
[KitpagesFileSystemBundle] git=http://github.com/kitpages/KitpagesFileSystemBundle.git target=Kitpages/FileSystemBundle
Step2: Configure the autoloader
Add the following entries to your autoloader:
registerNamespaces(array( // ... 'Imagine' => __DIR__.'/../vendor/imagine/lib', )); Step3: AppKernel.php Add the following entries to your autoloader: $bundles = array( ... new Kitpages\FileSystemBundle\KitpagesFileSystemBundle(), ); Step4: Configuration example ===================== kitpages_file: tmp_dir: %kernel.root_dir%/data/tmp type_list: image: resize: form: 'kit_file.image.resize.form' form_twig: 'KitpagesFileBundle:ActionOnFile:Image/Resize/form.html.twig' handler_form: 'kit_file.image.resize.form.handler' library: 'imagine.gd' kitpages_file_system: file_system_list: kitpagesFile: local: directory_public: %kernel.root_dir%/../web directory_private: %kernel.root_dir% base_url: %base_url% Step5: php bin/vendors update Step6: launch command: php app/console kitFile:updateDatabase Extend entity ============ see entity File create a entity - class Extendentity extends FileBase create a repository - class ExtendentityRepository extends FileBaseRepository { CONST entity = 'AppSiteBundle:Extendentity'; } complete config.yml entity_file_name_list: default : class: Kitpages\FileBundle\Entity\File data_dir_prefix: /default Extendentity : class: App\SiteBundle\Entity\Extendentity data_dir_prefix: /ExtendentityDir