Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 无法上载多个映像-Springboot_Image_Spring Boot_Arraylist_File Upload - Fatal编程技术网

Image 无法上载多个映像-Springboot

Image 无法上载多个映像-Springboot,image,spring-boot,arraylist,file-upload,Image,Spring Boot,Arraylist,File Upload,我正在尝试在Springboot中上载多个图像 这是我的HTML表格: <form th:action="@{${#httpServletRequest.requestURI}}" th:object="${formInput}" method="post" enctype="multipart/form-data" onsubmit="return validate();"> 要接收多个文件,请执行以下操作: <input type="file" onclick="ra

我正在尝试在Springboot中上载多个图像

这是我的HTML表格:

<form th:action="@{${#httpServletRequest.requestURI}}" th:object="${formInput}" method="post" enctype="multipart/form-data" onsubmit="return validate();">

要接收多个文件,请执行以下操作:

<input type="file" onclick="radioButton()"  onchange=" enableSubmit();" id = "fileInput" name="uploadingFiles[]" accept="image/*" multiple/>

这是我的控制器:

@RequestMapping(value = "/userProfiles/{userId}/setup/Tool.html", method = RequestMethod.POST)
public void makeIAmVideo(@PathVariable Long userId, HttpServletResponse response, @RequestParam(value = "track_value") int trackNumber, @RequestParam("uploadingFiles") MultipartFile[] uploadingFiles) throws IOException {
    UserProfile userProfile = userProfileRepository.findById(userId);
    ArrayList<String> photos = new ArrayList<>();
    String audioPath= audioPath1;
    System.out.println(trackNumber);
    for(MultipartFile file : uploadingFiles){
        photos.add(file.getName());
    }
 }
@RequestMapping(value=“/userProfiles/{userId}/setup/Tool.html”,method=RequestMethod.POST)
public void makeIAmVideo(@path variable Long userId,HttpServletResponse,@RequestParam(value=“track_value”)int trackNumber,@RequestParam(“uploadingFiles”)MultipartFile[]uploadingFiles)引发IOException{
UserProfile UserProfile=userProfileRepository.findById(userId);
ArrayList photos=新建ArrayList();
字符串audioPath=audioPath1;
System.out.println(轨道号);
用于(多部分文件:上载文件){
photos.add(file.getName());
}
}
但是当我调试它时,照片不会上传到照片数组列表中,它的大小保持为0


我做错什么了吗?

在表单中添加这些包含此输入字段的行

enctype="multipart/form-data"

实际上,我在表单标签中有: