I am using Django and Django Rest Framework. How to validate the image size of the image posted to django rest framework api ?
This is a bit confusing :
FILE_UPLOAD_MAX_MEMORY_SIZE = #something
The maximum size, in bytes, for files that will be uploaded into memory. Files larger than FILE_UPLOAD_MAX_MEMORY_SIZE will be streamed to disk. Defaults to 2.5 megabytes.
I set this to 255 and even then I was able to upload a 2MB image from django admin. I want to reject the POST request and raise error if image size is larger than 5MB