0

I have django inline to uploads files, so it can upload multiple files at same time. (one file for a one file field)

And my nginx limits upload size to 20MB.

Now I want to check the total size of all files, and give proper error massage if it exceeds 20MB before nginx does.

Any helps? please.

mhs
  • 1,012
  • 2
  • 14
  • 35
  • You won't have this problem because your code runs after nginx successfully validates the request. So, if it fails the nginx check, your code won't receive the request and so you don't need to re-check the file size. – Burhan Khalid Apr 03 '19 at 05:52
  • @Burhan Khalid, Thanks for the comment. I guess there is no way to show a custom error message then – mhs Apr 03 '19 at 05:56
  • 1
    You can increase the maximum file size on nginx, and then check the file size on the django side to display a custom error message. – Burhan Khalid Apr 03 '19 at 05:59
  • @Burhan Khalid, If I increase the size of nginx, do you have any suggestions to limit the total size by django? – mhs Apr 03 '19 at 06:53

0 Answers0