ring icon indicating copy to clipboard operation
ring copied to clipboard

How to limit max upload size?

Open ertugrulcetin opened this issue 8 years ago • 7 comments

Is there any way to limit max upload size? If so could you provide an example please?

ertugrulcetin avatar Jun 29 '17 16:06 ertugrulcetin

You mean with the multipart middleware?

weavejester avatar Jun 29 '17 16:06 weavejester

On jetty side, I have an endpoint which accepts octet-stream I want it to fail if it exceeds the limit.

ertugrulcetin avatar Jun 29 '17 16:06 ertugrulcetin

Also yes, multipart middleware

ertugrulcetin avatar Jun 29 '17 16:06 ertugrulcetin

@weavejester any suggestions?

ertugrulcetin avatar Jun 30 '17 19:06 ertugrulcetin

You can create a custom multipart store that limits the files to a certain size. Take a look at ring.middleware.multipart-params.temp-file and ring.middleware.multipart-params.byte-array. You can adapt or wrap these multipart stores to limit the size of the items.

I don't currently have time to come up with an example for you, however.

weavejester avatar Jun 30 '17 20:06 weavejester

@weavejester thank you so much I think I figured it out! Are you gonna add this functionality to ring any time soon? That would be useful though

ertugrulcetin avatar Jun 30 '17 20:06 ertugrulcetin

When I get time, or someone sends me a PR, it would be useful functionality to have.

weavejester avatar Jul 03 '17 22:07 weavejester