To allow a controller method to accept multipart form request, simply use Action.multipart instead of Action.
@Post("/upload")
def upload(): Action = Action.multipart: multipartRequest =>
val files = multipartRequest.files // all files uploaded
val fileOpt = multipartRequest.findFile("fileNameRegex") // find file by field name
"Do something with your file"
Last modified on 22/11/2023, 3:49 pm