-1

How can I implement an endpoint with Spring to receive a large file? For example I have to upload a 2GB file but my RAM is 512MB.

Is there any way to receive parts of the file and store them directly on disk?

James Graham
  • 39,063
  • 41
  • 167
  • 242
  • If you are using a cloud provider you should also look into signed urls, which would enable you to upload files directly into a storage bucket. – Andreas Dec 02 '21 at 12:58

1 Answers1

0
spring.servlet.multipart.max-file-size=2GB
spring.servlet.multipart.max-request-size=256MB
  • spring.servlet.multipart.max-file-size is set to 2GB, meaning total file size cannot exceed 2GB.

  • spring.servlet.multipart.max-request-size is set to 256MB, meaning total request size for a multipart/form-data cannot exceed 256MB.

See https://spring.io/guides/gs/uploading-files/

James Graham
  • 39,063
  • 41
  • 167
  • 242