uploading file in django and python?
<input type="file" name="doc-file" multiple/>
file_path = request.FILES.get('doc-file')
My return valu开发者_开发问答e of file_path is None
But when I do file_path = request.POST.get('doc-file')
it returns filename
. What is the best way to upload a file in python and django?
It sounds like you might be forgetting to include enctype="multipart/form-data"
in your form tag. See Django's docs on file uploads for details.
Edit: formatting
精彩评论