Download the PHP package patroklo/octobercms-improved-fileupload without Composer
On this page you can find all versions of the php package patroklo/octobercms-improved-fileupload. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download patroklo/octobercms-improved-fileupload
More information about patroklo/octobercms-improved-fileupload
Files in patroklo/octobercms-improved-fileupload
Package octobercms-improved-fileupload
Short Description Improves October CMS file upload form widget options with user defined rules.
License MIT
Homepage https://github.com/Patroklo/OctoberCms-improved-fileupload
Informations about the package octobercms-improved-fileupload
OCTOBER CMS IMPROVED FILE UPLOAD FORM WIDGET
A simple extension for the October CMS's FileUpload form widget that lets the addition of user defined rules in the form YAML config files or the models where the field is declared.
Installation
Manually from your terminal typing:
Or add this to your project's composer.json
file:
And it's done!
New image mode
There's a new mode in the form widget called image-multi-big
. When activated, it will make bigger images when uploading them than the standar multiupload.
To activate this mode you only have to declare it in the yaml file:
New Rules
There are an additional set of rules developed to increase the performance of the form system:
maxFiles:[number]
This rule must only be used in this form widget.
It checks the number of uploaded files linked into this model and, if it's more than the defined number, will throw an error and stop the upload.
Configuration
Add the form widget into your YAML config form files:
Since this is not a default form widget the better way to do this is declaring the class full namespace:
And now you can use the form widget as is it was the default version of FileUpload.
User defined rules
The rules are the very same that are used in the Validation library, with additional ones defined in the New Rules section.
If you want to use user defined upload rules, there are two different ways to accomplish this: add a YAML option in the form config file or a method into the method class.
The YAML config file will have priority over the model's method one, so if you have both defined at the same time, it will be applied the YAML one.
Adding the rules into the YAML config file:
Adding the rules into a model's method
You can add a new method into the model that holds the attribute where you can add your files that will store all it's rules.
This way of adding rules has the benefit of allowing dynamic rules.
And that's all folks! Any question or idea you have will be welcomed!
All versions of octobercms-improved-fileupload with dependencies
october/rain Version ~1.0
october/system Version ~1.0
october/backend Version ~1.0
october/cms Version ~1.0