I'm guessing the problem is in one of the "..." portions of your view.
In particular, I'd be interested to see how you're instantiating your
form. If you're using "Information(request.POST)", that's your
problem. Try using "Information(request.POST, request.FILES)" instead,
and see if that helps. If you're already doing that, you may need to
post the rest of your view in its entirety before we can help much
more.

-Gul

On Dec 19, 2007 10:11 AM, Jiri Barton <[EMAIL PROTECTED]> wrote:
>
> I used to store images in the database. Now I want to store them on a
> disk. I have the following model:
>
> class User(models.Model):
>     image = modes.ImageField(upload_to='userimages')
>     ...
>
> then, I have a new form like
>
> class Information(forms.Form):
>     image = forms.ImageField(required=False)
>
> now, what should I call to actually save the image? I'm lost. I don't
> know what I should implement myself. I have
>
> def handle(request, object_id):
>     user = get_object_or_404(User, pk=object_id)
> ...
>     form.is_valid()
> ....
>     image = form.cleaned_data['image']
>     if image:
>         user.save_image_file(image.filename, image.content,
> save=False)
>     user.save()
>
> However, this does not update user.image field content nor creates a
> file. How is forms.ImageField intended to work?
>
> Thank you very much,
> Jiri
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to