I'm trying to upload a text file from a html form.
Is there any example on how to get the text-file from the HttpHandler
I once used the following code:
Builder builder = FormParserFactory.builder();
final FormDataParser formDataParser = builder.build().createParser(exchange);
if (formDataParser != null) {
exchange.startBlocking();
FormData formData = formDataParser.parseBlocking();
for (String data : formData) {
for (FormData.FormValue formValue : formData.get(data)) {
if (formValue.isFile()) {
// process file here: formValue.getFile();
}
}
}
}
Based on: http://www.programcreek.com/java-api-examples/index.php?api=io.undertow.server.handlers.form.FormData
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With