You need to set the form with the request file, which I think you may have missed: from appname.forms import ImageForm form = ImageForm(request.POST,request.FILES)
>From the documentation: http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#basic-file-uploads On Tue, Aug 4, 2009 at 8:30 PM, Martje <martijn.basti...@gmail.com> wrote: > > One question though. Even when it is in request.FILES, it doesn't get > saved like I expected it would. > > I expected Django to upload my image to "media/afbeeldingen/ > gastenboek/" ánd validate if it is an image or not (I've change > FileField to ImageField). > > Why doesn't Django do this? > > On 4 aug, 15:19, Martje <martijn.basti...@gmail.com> wrote: > > You're right, that was the problem. Thanks! > > > > On Aug 4, 2:18 pm, James Bennett <ubernost...@gmail.com> wrote: > > > > > On Tue, Aug 4, 2009 at 7:08 AM, Martje<martijn.basti...@gmail.com> > wrote: > > > > This seem ok, since I only used field 3 and 1. But when I look at > > > > request.FILES, I get: > > > > > > <MultiValueDict: {}> > > > > > > It shouldn't be empty, should it? > > > > > If you've forgotten to set the 'enctype' attribute of the HTML <form> > > > element properly, you won't get any files sent. The documentation > > > covers this and how to programmatically detect forms which need it: > > > > >http://docs.djangoproject.com/en/dev/ref/forms/api/#testing-for-multi. > .. > > > > > -- > > > "Bureaucrat Conrad, you are technically correct -- the best kind of > correct." > > > > > > > -- Regards, Lakshman becomingguru.com lakshmanprasad.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---