in Playframework 2.2, it is possible to bind an entity from request like so:
Form<EntityA> form = form.bindFromRequest();
EntityA entity = filledForm.get();
It seem to work for String values but it doesn't seem to work when I have a file in the entity and using the @inputFile notation.
I can read the file via multipart form data as such:
MultipartFormData body = request().body().asMultipartFormData();
FilePart picture = body.getFile("uploadedFile");
But that is not elegant because I need to read the file via multipart form data and the other fields via the bindFromRequest.
I would like to do something like this:
Form<EntityA> form = form.bindFromRequest();
EntityA entity = filledForm.get();
File file = entity.uploadedFile;
but only null gets returned when the field is a file.
How do we upload a file into a form and get it directly from the binded form and not the multipart form data?
Thank you.