Asset Constraints for Craft CMS
As files are uploaded via the asset manager they will be checked against the constraints you define. If a constraint is not passed the upload will be rejected.
- Download a copy of this repository.
- Move the
assetconstraintsdirectory into yourcraft/pluginsdirectory. - Go to Settings > Plugins from your Craft control panel and enable the
Asset Constraintsplugin.
Go into the Asset Constraints settings and add one or more constraints. Each constraint consists of a source folder, file type and maximum file size. To completely block files of a certain type set the maximum size to '0'. Whenever a file is uploaded via the Asset panel it will be checked against constraints that match the destination folder. If the file fails a constraints test the upload will be rejected.
In addition to the locally set constraints that can be defined on the settings screen you can also use the config.php file to set constraints. To use the config file, copy the config.php file to a file called assetconstraints.php and move it to the craft/config directory. Use the example in the file as a guide to setup constraints.
The entire dev team at Firstborn
File icon by rajakumara from the Noun Project