开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜