Again I found the answer... I forgot to put enctype="multipart/form-data" in my form... sorry for disturbing you.
-S Salvatore Leone ha scritto: > Hello again, > > I know this is probably an already discussed question, but I can't get > out of this. I've got a form which may or may not send a file, here is > the snippet of my view function: > > > if request.method == POST: > #process the form > ... > > if request.FILES: > attached_file = request.FILES['attached_file'] > attach = Attach() # my model holding the file > attach.file(attached_file) > attach.save() > > > and here is my model for attachs: > > > class Attach(models.Model): > attached_file = models.FileField(upload_to='file_risposte') > risposta = models.ForeignKey(Risposte) > > > the problem is that *never* saves an attach. > > any idea? > > -Salvatore > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---