Reputation: 2913
I am quite confused.
I have wrote an upload form in my site. everything works perfectly..
however, I am reading that I needed to implement a function like handle_uploaded_file to dump the file content from the request.FILES to a physical file.
however , I didn't do it any the file exists in the location I set the upload_to in the FileField field. everything works as expected..
Am I missing something ? why do I need handle_uploaded_file then ?
Upvotes: 1
Views: 470
Reputation: 847
No, you do not need to do a handle_uploaded_file. When you save the object (form.save) Django already does this for you.
Look this: https://github.com/django/django/blob/master/django/db/models/fields/files.py#L270-276
Upvotes: 2