1

I have a use case where I want to limit the allowed file size for a certain Assets Volume to 20kb. All other volumes should be allowed files no matter the size.

I have looked at some other threads already that suggest developing a plugin to do this, or use the Yii event system for file uploads.

I have made other simple plugins before that interacted with entries, but I cannot understand how to make a plugin that latches onto the file uploading event.

Does anyone have any good documentation for where to begin with this? It is version 3.0

2

There's no way for the moment to limit filesize by Volume, but your can create a custom module with the EVENT_BEFORE_SAVE hooked on Assets.

Here's a related post.

| improve this answer | |
  • 'Limit' for Craft fields refers to the maximum number of files that can be assigned to a field, not the file size (or total file size) of those files. – Jamie Wade Feb 14 '19 at 15:03
  • Not enough coffee this morning -_- – Maxime Lafrenière Feb 14 '19 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.