0

I upload file from JSP but unable to get it in controller @ModelAttribute . File Controller.java

@RequestMapping(method = RequestMethod.POST)
public String createTestConfig(Model model, @Valid @ModelAttribute("myConfig") myConfigDTO myConfig, BindingResult bindingResult, Errors errors, final RedirectAttributes redirectAttributes){
    MultipartFile multipartFile = myConfig.getMyFile();
}

In above, multipartFile shows null

File UI.jsp

<input type="file" name="myFile" path="myFile" />

File dispatcher-servlet.xml

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <property name="maxUploadSize" value="99999999999"/>
</bean>

Please let me know if any solution.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
surm
  • 167
  • 2
  • 11
  • 1
    Check this https://stackoverflow.com/questions/26964688/multipart-file-upload-using-spring-rest-template-spring-web-mvc – shazin Sep 06 '22 at 08:47

0 Answers0