How to validate max size images individually?

SpatieMediaLibraryFileUpload::make('carousel')
->multiple()
->maxSize(4096)
SpatieMediaLibraryFileUpload::make('carousel')
->multiple()
->maxSize(4096)
for each uploaded image, i want it to not overpass 4096, is that possible anyhow or it will just set the max size for all images?
8 Replies
einnlleinhatt_
einnlleinhatt_16mo ago
Isn't that alrd working ? It multiple image uploaded it will check each image size limit
ericmp #2
ericmp #2OP16mo ago
@einnlleinhatt_ , u assume it will check each image size limit or u know it? like, setting multiple makes that 4096 is being multiplied by the amount of files i upload? im trying to check it in the vendor, but i think it doesnt
toeknee
toeknee16mo ago
maxSize should be individual image size.
ericmp #2
ericmp #2OP16mo ago
okay, now i was doing this xd:
->maxFiles(15)
->maxSize(15 * 4096)
->maxFiles(15)
->maxSize(15 * 4096)
toeknee
toeknee16mo ago
lol
ericmp #2
ericmp #2OP16mo ago
(,:
toeknee
toeknee16mo ago
It would make zero sense to set an overall file size limit
ericmp #2
ericmp #2OP16mo ago
🤷 sorry hehe thanks for the help y'all

Did you find this page helpful?