I come across the task to save files on my server (Max file size is 10 mb) and found this answer. This works perfectly, but I'm wondering what is the point to use shutil module and what is the difference between:
file_location = f"files/{uploaded_file.filename}"
with open(file_location, "wb+") as file_object:
file_object.write(uploaded_file.file.read())
vs
import shutil
file_location = f"files/{uploaded_file.filename}"
with open(file_location, "wb+") as file_object:
shutil.copyfileobj(uploaded_file.file, file_object)
During my programming experience, I was coming across with shutil module multiple times but still can't find out the benefits of one more import.