Skip to content

Instantly share code, notes, and snippets.

@mesuutt
Last active Oct 25, 2018
Embed
What would you like to do?
Django save file to storage & Read from storage without model
from django.core.files.storage import default_storage
# Saving POST'ed file to storage
file = request.FILES['myfile']
filename = default_storage.save(file.name, file)
# Reading file from storage
file = default_storage.open(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment