1👍
✅
The Content-Type header is completely arbitrary (and optional) and not a good way to detect whether or not you’re dealing with a valid ZIP file. Have you made sure your browser is supplying it?
Django’s documentation tells us the same:
UploadedFile.content_type
The content-type header uploaded with the file (e.g. text/plain or application/pdf). Like any data supplied by the user, you shouldn’t
trust that the uploaded file is actually this type. You’ll still need
to validate that the file contains the content that the content-type
header claims – “trust but verify.”
You should be using zipfile.is_zipfile
instead.
Source:stackexchange.com