title: Failed to convert property value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile'
body: <p>I have trouble with convert type &quot;multipart&quot;</p>
  <p>&quot;Failed to convert property value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'java.lang.String' for property 'foto'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'java.lang.String' for property 'foto': no matching editors or conversion strategy found&quot;</p>
  <p>my Code :
  Controller</p>
  <pre><code>@RequestMapping(value = &quot;/desainkartu/action.insert&quot;, method = RequestMethod.POST)
  public String actionInsert(@Valid @ModelAttribute(&quot;data&quot;) DesainKartu data,
                             BindingResult bindingResult,
                             Model model,
                             Principal principal,
                             @RequestParam(&quot;files&quot;) MultipartFile[] files) throws IOException  {
      StringBuilder fileNames = new StringBuilder();
      String url = &quot;desainkartu/insert&quot;;
      try {
          if(bindingResult.hasErrors()) {
              StringBuffer errorMessage = new StringBuffer();
              List&lt;FieldError&gt; aList = bindingResult.getFieldErrors();
              for(FieldError bList : aList) {
                  errorMessage.append(&quot;&lt;div&gt;&quot;+bList.getDefaultMessage()+&quot;&lt;/div&gt;&quot;);
                  url = &quot;desainkartu/insert&quot;;
              }
              for(MultipartFile file : files) {
                  Path fileNameAndPath = Paths.get(uploadDirectory, file.getOriginalFilename());
                  fileNames.append(file.getOriginalFilename());
                  Files.write(fileNameAndPath, file.getBytes());
              }
              model.addAttribute(&quot;message&quot;, errorMessage.toString());
          } else {
              try {
                  data.setCreatedby(principal.getName());
                  data.setCreateddate(date1);
                  service.save(data);
                  url = &quot;redirect:/desainkartu/list?status=true&quot;;
              } catch (Exception e) {
                  StringBuilder ste = new StringBuilder();
                  ste.append(e.getMessage());
                  for(StackTraceElement element : e.getStackTrace()) {
                      ste.append(element.toString()+&quot;\n&quot;);
                  }
                  log.error(ste.toString());
                  model.addAttribute(&quot;message&quot;, ste.toString());
              }
          }
  </code></pre>
  <p>properties</p>
  <pre><code>spring.http.multipart.max-file-size=15MB
  spring.http.multipart.max-request-size=15MB
  multipart.enabled=true
  </code></pre>
  <p>thanks</p>