ImageModel form problem
I'm trying to upload an image from a form. I'm using Ima开发者_如何学CgeModel with the User as a foreign key, I'm having trouble with the form . any help will be highly appreciated, please, thanks
Make sure your form tag contains enctype="multipart/form-data"
and that you bind your form to request.POST, request.FILES
views.py:
some_view(request):
if request.POST:
form = myForm(request.POST, request.FILES)
....
template.html:
<form method='POST' enctype='multipart/form-data'>
...
精彩评论