Is there a way to get the content type of an upload file when overwriting the models save method? I have tried this:
def save(self): print(self.file.cont
I'm using Django Rest Framework and this is the simplest I could go:
file = request.data.get("file") # type(file) = 'django.core.files.uploadedfile.InMemoryUploadedFile' print(file.content_type)
Let's say I have uploaded a JPEG image then my output would be:
image/jpeg