0

I am getting out of memory heap when uploading large files. Is there any solution to upload large files without using heap memory or any library that doesn't read this stuff into RAM before writing it to mysql.

@PostMapping("/upload")
    public ResponseData uploadFile(@RequestParam("file")MultipartFile file) throws Exception {
        Attachment attachment =  null;
        attachment = fileStorageService.saveAttachment(file);
        String uriString = "/download/".concat(attachment.getId());
        return new ResponseData(attachment.getName(), uriString, file.getContentType(), file.getSize());
    }

Thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Yogesh Rao
  • 107
  • 1
  • 1
  • 5
  • Disable multipart parsing in Spring (Boot) and do a streaming file upload using Apache Commons Fileupload. – M. Deinum Jul 09 '23 at 13:30

0 Answers0