Created
May 27, 2020 10:32
-
-
Save TiagoTi/4328ba5d0986cbc0a68dd85c61446b4b to your computer and use it in GitHub Desktop.
Django save InMemoryUploadedFile (a temporary uploaded file) to disk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.files.storage import default_storage | |
from django.core.files.base import ContentFile | |
file = request.FILES['your_file_fieldname'] | |
path = default_storage.save('heart_of_the_swarm.txt', ContentFile(file.read())) | |
#https://twigstechtips.blogspot.com/2012/04/django-how-to-save-inmemoryuploadedfile.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, it was usefull for me.