From: Chander <bl...@gm...> - 2020-10-26 03:21:03
|
Hi, I am using HtmlUnit to upload a file by making a request to the spring controller. The file is of type MultipartFile. Using the below code works only for File Type java.io.File. How do i make the call for MultipartFile? WebRequest request = new WebRequest(new URL("/customer/uploadfile),POST); request.setRequestParameters(toList(new KeyDataPair("newfile", file,"customerfile", "multipart/form-data", StandardCharsets.UTF_8))); I always receive Null inside the method for the file.. public ModelAndView uploadCustomerFile(ModelMap model, RedirectAttributes redirect, @ModelAttribute MultipartFile file ) { } Please let me know.. Thanks for your time, Chander |