使用 django-profiles 上传文件

发布于 2024-07-08 13:57:32 字数 302 浏览 2 评论 0原文

我正在使用 django-contrib 包 django-profiles,并且一切都很好 - 我唯一的问题是我希望表单上传文件(用于头像),不幸的是 - 表单不上传文件。

有没有人成功地使用 django-profiles 进行文件上传? 我想避免只为头像设置单独的上传视图?

任何帮助深表感谢!

谢谢, 马丁

I'm using the django-contrib package django-profiles, and everything is working great - my only issue is that I would like the form to upload a file (for an avatar), unfortunately - the form does not upload the file.

Has anyone successfully managed to get file uploads working with django-profiles? I want to avoid having to set up a seperate upload view just for the avatar?

Any help is much appreciated!

Thanks,
Martin

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

计㈡愣 2024-07-15 13:57:32

在您的模板中,在表单标签中添加 enctype="multipart/form-data" 。 例子:

<form method="post" action="." enctype="multipart/form-data">

In your template add enctype="multipart/form-data" in form tag. Example:

<form method="post" action="." enctype="multipart/form-data">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文