Thanks for breaking this down, Tom. I'll play around with it and see if I'm grasping this.
Regards, Lloyd On Fri, Nov 26, 2010 at 5:55 PM, Tom Evans <tevans...@googlemail.com> wrote: > On Fri, Nov 26, 2010 at 3:44 PM, Sithembewena Lloyd Dube > <zebr...@gmail.com> wrote: > > Thanks Daniel, makes sense. I gather that what Bruno meant to say on his > > soapbox was that the file is in the HTTP request object and can/ should > not > > be accessible from the hard disk? > > > > I was familiar with that, as the file upload dialogue does the job of > > reading the file off the disk and into memory. > > > > So I see where I went wrong :) I was trying to read the file off the > disk. > > I'll see if I can manipulate the file in a view, where I have access to > the > > request object. > > > > Is that the gist of the problem? > > > > Thanks Daniel! > > > > Not really. > > 1) User chooses file from disk > 2) Browser reads file from disk, and generates POST request > 3) Django receives POST request, and generates temporary file to store > received POST data > 4) Django model form processes request, and moves temporary file into > the location specified by upload_to attribute on model field > 5) You save the model instance, which puts us into the save() method, > where you want to create a thumbnail of the file > > At this point, the full size image is on disk, in > os.path.join(settings.MEDIA_ROOT, instance.file_field.path). You want > to read that image in, create a django.core.files.File (or subclass) > instance for the thumbnailed image, and assign it to the thumbnail > field on the model. > > Cheers > > Tom > > -- > 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<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Regards, Sithembewena Lloyd Dube http://www.lloyddube.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-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.