On 07/09/10 20:56, ranjan.kumar wrote

> forms.FileField(upload_to='some_dir/')
> 
>     The error message that i'm getting is: init() got an unexpected
> keyword argument ‘upload_to’
> 

You're confusing forms.FileField [1] and models.FileField [2]

The latter is the one that takes the upload_to kwarg saying where
to put the file associated with a model instance.

forms.FileField itself "just" gives you a file[-like object] living in
some temporary storage that you then need to save somewhere else if you
want to keep it permanently. (When you use a Model with a
models.FileField and a ModelForm with its form.FileFields autogenerated
from it, the "more permanently" is being handled for you when you
.save()...)

[1]
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#where-uploaded-data-is-stored

[2]
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.upload_to

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
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