-
I'm a bit confused about the docs. I understand how to set a global limit but I want different limits in different upload collections: ie I have an images collection and a videos collection. In my videos collection I tried adding both Videos.js ...
access: {},
upload: {
mimeTypes: ['video/mp4'],
fileSize: 5000000, // 5MB, written in bytes
} Throws Videos.js ...
access: {},
upload: {
mimeTypes: ['video/mp4'],
limits: {
fileSize: 5000000, // 5MB, written in bytes
}
} Also throws What would the correct way to declare this be? Thanks in advance, 💖 payload |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @gonzam88 — I see what you're looking to do. And I think this is a totally reasonable request. As you've noticed, you can only specify global upload filesize limitations, but you can extend the built-in Here's the built-in const filesize = {
name: 'filesize',
label: 'File Size',
type: 'number',
admin: {
readOnly: true,
disabled: true,
},
}; Just add that to your collection's base level with a custom validation function and then you're off to the races! |
Beta Was this translation helpful? Give feedback.
Hey @gonzam88 — I see what you're looking to do. And I think this is a totally reasonable request.
As you've noticed, you can only specify global upload filesize limitations, but you can extend the built-in
filesize
field with afilesize
field of your own, complete with a custom validation function that will enforce max upload sizes for you.Here's the built-in
filesize
field:Just add that to your collection's base level with a custom validation function and then you're off to the races!