I want to create rest API in Spring while will be used to upload gallery images at once. Below is my Gallery Pojo.
import org.springframework.web.multipart.MultipartFile;
public class Gallery {
private String title;
private String desc;
private MultipartFile file;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public MultipartFile getFile() {
return file;
}
public void setFile(MultipartFile file) {
this.file = file;
}
}
In my Spring RestController I'm accepting List<Gallery>
object.
@RequestMapping(value="/gallery-images-save", method=RequestMethod.POST)
public Response saveGalleryImages(List<Gallery> galleryImages) {
// my code to process and save gallery images.
}
I found one solution but there Multipart array is accepted as request data.
like. List<MultipartFile>
but in my scenario i want List<Gallery>
where Gallery contains one single MultipartFile
object.