Chuck22
unread,Dec 21, 2008, 11:33:48 PM12/21/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I have three ImageField in my form and model, I want to know how to
upload the three image files in the form processing code. I found
Django Admin page handles the image file upload nicely. And I want to
do the exactly same work. But I can not find the piece of code that
does the job when searching the Django source code. Can anyone point
to me where these code are located? Or share some code snippets
related to this.
in my model:
image1 = models.ImageField(upload_to='img/bk', blank=True)
image2 = models.ImageField(upload_to='img/bk', blank=True)
image3 = models.ImageField(upload_to='img/bk', blank=True)
in my form processing:
if request.method == 'POST':
f = MyForm(request.POST, request.FILES)
if f.is_valid():
email = f.cleaned_data['email']
title = f.cleaned_data['title']
...
# save the uploaded images
for v in request.FILES:
save_upload_file(v) <---- this is where i am stuck