Hi Everyone,

I'm confused about creating a custom upload handler and how it ties
into my model. From the docs, this is an example of a custom upload
handler, which I'm assuming goes in my view, or is accessed from my
view:

def handle_uploaded_file(f):
    destination = open('some/file/name.txt', 'wb+')
    for chunk in f.chunks():
        destination.write(chunk)
    destination.close()


Let's say my model is:

class MyModel(models.Model):
    my_file = models.FileField(upload_to='uploads/')


How do the FileField "my_file" and the handler "handled_uploaded_file"
work together? In my project, I need to allow users to upload large-
ish files. Say 10 - 20 MB. What's the best way to handle this
functionality? I would sincerely appreciate an example if someone has
one.

Kindest Regards,
Brandon

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

Reply via email to