Hmm... no reply. Its either a very dumb question or I explained it very bad! I though I would reactivate it since I didn't find out yet...
Thanks! Divan On Nov 4, 5:57 am, Divan Roulant <[EMAIL PROTECTED]> wrote: > Hello, > > I need to upload several pictures from a single form. Then (I think) I > need to loop through the list of FILES and bind the data to a form and > save it. However, my code below doesn't work. No images are saved and > all I get is the data from the other fields of the last picture, saved > the number of times the loop runs. > > for i in request.FILES.getlist('photo'): > my_form = form_for_model(TheForm) > my_form_instance = my_form(request.POST, i) > if my_form_instance.is_valid(): > f = my_form_instance.save() > f.save() > else: > # Catch exceptions > > I guess that the nature of "i" is not the proper one for the line > "my_form _instance = my_form(request.POST, i)". If so, what should be > done to bind the right data each time the loop is executed? > > Thanks! > > Divan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---