Form Post With Upload

388 views
Skip to first unread message

Madan Chowdary

unread,
Nov 13, 2013, 2:11:08 AM11/13/13
to extdire...@googlegroups.com
Hi All,

I have a form with some input elements along filefield. I followed the example mentioned in 'Form Post with Upload' example and see the file is uploaded as expected.

But the example doesn't mention on reading other form data that is submitted.

I am reading the submitted form data by calling getParameter on HttpServletRequest and got it working as expected. 

Is there any other way I can map the form data to a bean as shown below

@ExtDirectMethod(value = ExtDirectMethodType.FORM_POST)
public ExtDirectFormPostResult saveDocument(@RequestParam("fileUpload") MultipartFile fileUpload,@RequestBody FormDataVo formDataVo) throws Exception {...}

Right now the above method is not invoked and an exception is thrown something like below

'org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'multipart/form-data;boundary=----WebKitFormBoundary' not supported'

Thanks,
Madan N




Ralph Schaer

unread,
Nov 13, 2013, 3:34:55 AM11/13/13
to extdire...@googlegroups.com
The simple starter app https://github.com/ralscha/archetypes/tree/master/eds-starter-simple-app contains a form post service that consumes a multipartfile and additional data. The service looks like this:


@Service
public class FormSubmitService {
  @ExtDirectMethod(FORM_POST)
  public ExtDirectFormPostResult handleFormSubmit(FormBean bean, MultipartFile screenshot {
....
}


You can test the application online at this address: 


Madan Chowdary

unread,
Nov 13, 2013, 6:57:36 AM11/13/13
to extdire...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages