I am uploading a zip file through my form. How I can get the file size i.e in KB / MB so I can display it in my template.
Django has a builti |filesizeformat
template filter [Django-doc], you can thus use this with:
{{ file.size|filesizeformat }}
as the documentation says, this will:
Formats the value like a ‘human-readable’ file size (i.e.
'13 KB'
,'4.1 MB'
,'102 bytes'
, etc.).