Re: Django file upload. 'None'

2009-08-04 Thread Martje
Ah, thanks :-). On 4 aug, 17:18, Lakshman Prasad wrote: > 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/t

Re: Django file upload. 'None'

2009-08-04 Thread Lakshman Prasad
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:3

Re: Django file upload. 'None'

2009-08-04 Thread Martje
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:1

Re: Django file upload. 'None'

2009-08-04 Thread Martje
You're right, that was the problem. Thanks! On Aug 4, 2:18 pm, James Bennett wrote: > On Tue, Aug 4, 2009 at 7:08 AM, Martje wrote: > > This seem ok, since I only used field 3 and 1. But when I look at > > request.FILES, I get: > > > > > > It shouldn't be empty, should it? > > If you've forgott

Re: Django file upload. 'None'

2009-08-04 Thread James Bennett
On Tue, Aug 4, 2009 at 7:08 AM, Martje wrote: > This seem ok, since I only used field 3 and 1. But when I look at > request.FILES, I get: > > > > It shouldn't be empty, should it? If you've forgotten to set the 'enctype' attribute of the HTML element properly, you won't get any files sent. The

Django file upload. 'None'

2009-08-04 Thread Martje
Hey, I have the following HTML-code autogenerated for me by Django: That's ok according to my models.py: afbeelding1 = models.FileField(upload_to='media/afbeeldingen/ gastenboek/', verbose_name="", blank=True) afbeelding2 = models.FileField(upload_to='media/afbeeldingen/ gastenboek/', verb