I have a piece of code that gets a file from a form via POST.
file = request.FILES['f']
What would be the easiest way to save this file in my media folder in
settings.MEDIA_ROOT
I watched this answer , among other things, but I had errors referring to undefined names and invalid chunks methods.
Should there be an easy way to do this?
EDIT Load the method in my views.py:
def upload(request): folder = request.path.replace("/", "_") uploaded_filename = request.FILES['f'].name
python django django-models django-forms
Jon
source share