0

If I change FILE_UPLOAD_MAX_MEMORY_SIZE, do I have to change DATA_UPLOAD_MAX_MEMORY_SIZE as well?

Django default:

DATA_UPLOAD_MAX_MEMORY_SIZE = 2.5 Mb
FILE_UPLOAD_MAX_MEMORY_SIZE = 2.5 Mb

My api expects two files in a json request. Storing these files on disk is not an option. I have to work on these files in memory.

Should I just update FILE_UPLOAD_MAX_MEMORY_SIZE to 3Mb? Or should I change DATA_UPLOAD_MAX_MEMORY_SIZE to 8.5 Mb? Or should I change FILE_UPLOAD_MAX_MEMORY_SIZE to 3Mb and DATA_UPLOAD_MAX_MEMORY_SIZE to 8.5 Mb?

ABN
  • 1,024
  • 13
  • 26

1 Answers1

1

You should only change the FILE_UPLOAD_MAX_MEMORY_SIZE because DATA_UPLOAD_MAX_MEMORY_SIZE doesn't affect file uploads as you can read in the documentation :

The check is done when accessing request.body or request.POST and is calculated against the total request size excluding any file upload data.

Benbb96
  • 1,973
  • 1
  • 12
  • 21