1

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?

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.