html5 multiple file upload with spring mvc 4 and spring boot <p>I'm trying to upload multiple files using spring mvc 4, spring boot and thymeleaf as template engine, but i'm not able to access the uploaded files, the files are dealt with as one multipart file with content type application/octet-stream. here's my front-end code:</p> <pre><code> &lt;form name="offer-form" th:action="@{/submit-property}" method="POST" enctype="multipart/form-data"&gt; &lt;!-- .. other inputs .. --&gt; &lt;div class="col-xs-12 margin-top-60"&gt; &lt;input id="file-upload"name="files[]" type="file" multiple="multiple"/&gt; &lt;/div&gt; &lt;div class="col-xs-12"&gt; &lt;div class="center-button-cont margin-top-60"&gt; &lt;button type="submit" class="button-primary button-shadow"&gt; &lt;span&gt;submit property&lt;/span&gt; &lt;div class="button-triangle"&gt;&lt;/div&gt; &lt;div class="button-triangle2"&gt;&lt;/div&gt; &lt;div class="button-icon"&gt;&lt;i class="fa fa-lg fa-home"&gt;&lt;/i&gt;&lt;/div&gt; &lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>And the controller code:</p> <pre><code>import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.tomcat.util.http.fileupload.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import com.aq.domain.Property; import com.aq.service.AddPropertyFormDataInitializerService; @Controller public class PorpertySubmissionController { public static final Resource PICTURES_DIR = new FileSystemResource("./uploadedPictures"); //some unrelated code @RequestMapping(value="/submit-property", method=RequestMethod.GET) public String getSubmitPropertyForm(Model model) { model.addAttribute("property", new Property()); return "submit-property"; } @RequestMapping(value="/submit-property", method=RequestMethod.POST) public String submitProperty ( @ModelAttribute(value="property") Property property, @RequestParam("files[]") MultipartFile[] uploadedImages ) { //some unrelated code if(uploadedImages != null &amp;&amp; uploadedImages.length &gt; 0) { System.out.println("uploadedImages length: " + uploadedImages.length); for(MultipartFile imageFile : uploadedImages) { try { copyFileToPictures(imageFile); System.out.println("copied File: " + imageFile.getOriginalFilename() + " successfully."); } catch (IOException e) { System.err.println(e.getMessage()); e.printStackTrace(); } } } else { System.out.println("no images were uploaded"); } return "redirect:/submit-property"; } private Resource copyFileToPictures(MultipartFile file) throws IOException { System.out.println("File Original Name: " + file.getOriginalFilename()); System.out.println("File Name: " + file.getName()); System.out.println("File size: " + file.getSize()); System.out.println("File Content type: " + file.getContentType()); String fileExtension = getFileExtension(file.getOriginalFilename()); File tempFile = File.createTempFile("pic", fileExtension, PICTURES_DIR.getFile()); try (InputStream in = file.getInputStream(); OutputStream out = new FileOutputStream(tempFile)) { IOUtils.copy(in, out); } return new FileSystemResource(tempFile); } private static String getFileExtension(String name) { return name.substring(name.lastIndexOf(".")); } } </code></pre> <p>the output of the sysout:</p> <p>uploadedImages length: 1 (even though i upload multiple files)</p> <p>File Original Name (using getOriginalFileName): </p> <p>File Name (using getName): files[]</p> <p>File size: 0</p> <p>File Content type: application/octet-stream</p> <p>and then an exception when subsctring is called on the empty original file name.</p> <p>I tried to add commons file upload to my POM and configured CommonsMultipartResolver bean, but then it always prints that there are no uploaded images (which means it's null or length=0)</p>