Is InMemoryUploadedFile really "in memory"?

Viewed 7227

I understand that opening a file just creates a file handler that takes a fixed memory irrespective of the size of the file. Django has a type called InMemoryUploadedFile that represents files uploaded via forms.

I get the handle to my file object inside the django view like this:

file_object = request.FILES["uploadedfile"]

This file_object has type InMemoryUploadedFile.

Now we can see for ourselves that, file_object has the method .read() which is used to read files into memory.

bytes = file_object.read()

Wasn't file_object of type InMemoryUploadedFile already "in memory"?

2 Answers
Related