Put a size quota for each model #2452
Unanswered
zakriabilal
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to make it where each instance of my model can upload any number of files but limited to let's say 20MB in total. There is a function
onlyKeepLatest
which allows us to limit the number of files per model but not by file size.So It could be either 1 file that is 20MB or 30 files totalling 20MB.
Right now I'm handling this in the controller by calling a separate class that queries the DB using the
getMedia
and then calculates the total size currently used by summing the size column.So, I'm wondering what would be the best place to handle this?
Is there a better way to handling this? Please note I need to use this with like 20 different types of models.
Beta Was this translation helpful? Give feedback.
All reactions