private final StorageService storageService;
private MultipartConfigElement multipartConfigElement;
@Autowired
public FileUploadController(StorageService storageService, MultipartConfigElement multipartConfigElement) {
this.storageService = storageService;
this.multipartConfigElement = multipartConfigElement;
}
...
@PostMapping("/")
public String handleFileUpload(@RequestParam("file") MultipartFile file,
RedirectAttributes redirectAttributes) {
multipartConfigElement.getMaxFileSize(); // Value is 0 when inspected.
...
But it doesn't seem to do anything. The 16B test file still gets saved without any impact from the max-size configuration.
Although not directly related to this app, the documentation here lead me to believe that setting the max-size values would automatically produce some error, and if that's not the case it might be helpful to clarify.
I might be misunderstanding how the max-size configuration is supposed to be applied, but it doesn't seem to do anything.
You can set it to 0B (or anything else), and see that the configuration is picked up.
But it doesn't seem to do anything. The 16B test file still gets saved without any impact from the max-size configuration.
Although not directly related to this app, the documentation here lead me to believe that setting the max-size values would automatically produce some error, and if that's not the case it might be helpful to clarify.