Hi Steve, Nope, Linux machine... ??? On 17 Oct 2008, at 01:30, Steve Holden wrote:
> > [EMAIL PROTECTED] wrote: >> I have users dumping jpgs into a folder within the media root, the >> idea is to monitor this folder and programmatically add the jpgs to >> certain model instances based on a naming convention. It all works >> fine... except... every time i put a jpg in File object and save to a >> model the jpg gets corrupted. >> >> I've tried with both regular File() object and default_storage. >> >> f = open('%s' % infile, 'w') >> file = File(f) >> #file = default_storage.open(infile, 'wb') >> ProductImage.objects.create(product=product,sort=sort,picture=file) >> >> what am i missing here - should i be using PIL in some way? >> > Are you perchance running on Windows? If so you must write the files > in > binary mode to avoid the content being mangled ("\n" will be > replaced by > "\r\n" wherever it occurs). > > regards > Steve > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---