I\'m trying to get image file using ajax into Django views.py. I can print the file name and size of it. But when I open the file, it become None..!
The reason I\'m try
Once you have called read()
on a file subsequent calls will not yield any data. The first call to read()
reads the entire buffer and there will not be anything left when you call it again
print(type(request.FILES["file"].read())) # This line has read the entire buffer
imageFile = request.FILES["file"]
receipt_image = imageFile.read() # There is nothing left to read so this returns b''