Uploads, uploads everywhere!

Uploaded files are now easily accessible via: ctx.uploadedFiles()

  • Java
  • Kotlin
app.post("/upload", ctx -> {
    ctx.uploadedFiles("files").forEach(file -> {
        FileUtils.copyInputStreamToFile(file.getContent(), new File("upload/" + file.getName()));
    });
});
app.post("/upload") { ctx ->
    ctx.uploadedFiles("files").forEach { (contentType, content, name, extension) ->
        FileUtils.copyInputStreamToFile(content, File("upload/" + name))
    }
}

Other changes:

  • ctx.formParam() now uses same decoding as ctx.queryParam()
  • .start() is now required in order to start the server (previously declaring routes would also start the server)