以下のようにMultipartConfigアノテーションでmaxFileSizeを指定してあげることで制限をかけることができます。
@Controller
@RequestMapping("/test")
@MultipartConfig(maxFileSize=1024*1024, // 1MB
maxRequestSize=1024*1024*10)
public class FileUploadTestController {
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public RedirectView fileUpload(@RequestParam("csvfile") MultipartFile file) {
//処理...
}
}

コメント