Download the PHP package sidus/file-upload-bundle without Composer
On this page you can find all versions of the php package sidus/file-upload-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sidus/file-upload-bundle
More information about sidus/file-upload-bundle
Files in sidus/file-upload-bundle
Package file-upload-bundle
Short Description Allow to upload files directly in Doctrine entities, based on oneup/uploader-bundle and jQuery-file-upload
License GPL-2.0
Homepage https://github.com/VincentChalnot/SidusFileUploadBundle
Informations about the package file-upload-bundle
Sidus/FileUploadBundle
This bundle allows you to define Doctrine entities linked to a virtual filesystem entry through the Flysystem storage layer.
This means that when uploading a file, it will automatically create a corresponding entity in your database matching your resource type.
WARNING: These entities are meant to be associated to other Doctrine entities, not really managed by themselves: If you want to add a title and a description to a file, create a different entity and create an association to the resource.
The upload part is handled by the Oneup Uploader Bundle with very little magic added to it.
This documentation is a work in progress, the bundle is working as is but might require more configuration than what is explained here.
Installation
You will need to include jQuery in your project on your own.
Update your Kernel:
Note: The order is very important because we override some parameters frop Oneup.
Additional configuration in your composer.json to expose the jquery-fileupload vendor in public directory of this bundle.
Configuration example for OneUploader using Flysystem with local filesystem.
Note that in order for Sidus/FileUpload to work, the keys for the OneUploader, Flysystem and Sidus must match.
Note the reference in Oneup Uploader to the Flysystem filesystem :
Now define your uploadable entities, being careful with the configuration keys
Add the upload routes to your routing:
Minimum requirements for your entity
Load the necessary CSS and JS in your layout (there are many way to do this)
'bundles/sidusfileupload/css/fileupload.css'
'bundles/sidusfileupload/vendor/jquery-file-upload/js/jquery.fileupload.js'
'bundles/sidusfileupload/vendor/jquery-file-upload/js/jquery.fileupload-jquery-ui.js'
'bundles/sidusfileupload/vendor/jquery-file-upload/js/jquery.iframe-transport.js'
'bundles/sidusfileupload/js/jquery.fileupload.sidus.js'
To load the widget on document initialization (not exactly the proper way to do it...)
When creating a form, you can simply use the "sidus_resource" type to declare the field as an upload. You will only require to set the "resource_type" options corresponding to the entity you want to use.
Serializer
If you want the Symfony serializer support, you also need to require this:
You need to enable these bundles in your kernel:
And last, you need to enable serializer support in the configuration:
All versions of file-upload-bundle with dependencies
oneup/flysystem-bundle Version ~1.13
emgag/flysystem-hash Version ~1.0
oneup/uploader-bundle Version ~1.7
mopa/composer-bridge Version ~1.3
blueimp/jquery-file-upload Version ~9.18