I have 3 different type of uploads and i want to set a size limit for each one
Images : 1MB
Audio : 25mb
i found a global option in the documentation any idea how can i do this for each collection ?
hmmmm this is a very good question
right now we add the file-upload middleware once, on the
router - - meaning it gets passed options only once
i think this could be done by passing a custom
where you can write a validation on that field
can you elaborate more ?
ok so for every built-in field that Payload exposes, if youpass the config your OWN, with the same name
, Payload will "match" your provided field and merge in its defaults, with your settings as preference
here are the base upload collection fields that Payload injects:
if you swap in a field with name
, you could merge in a custom
function that enforces your restrictions 👍
like this ?
give that a shot
yesss its working ty ty
Get help straight from the Payload team with an Enterprise License.