Is there a way to limit the file upload size using...
# ktor
j
Is there a way to limit the file upload size using multipart with
ktor-server
? I'm using
1.6.8
.
a
This answer should help.
j
yep thank you, I did end up finding that stackoverflow. Created a plugin that would process the
MultipartData
to find the file and read the input. Tricky part was figuring out a way to read but also let other interceptors (plugins) have access to the parts. This was necessary since once you read the parts i.e.
readAllParts()
you cannot re-read them. In addition, once you
receiveMultipart
you cannot do it again unless you add the
DoubleReceive
plugin. Lots of different caveats in order to determine the file size. Most server engines (Netty, Tomcat, etc) process the file, so it wouldn't be too difficult to add an engine configuration similar to how Spring does it.
143 Views