I couldn't find ImageField validation in .96 To validate your images, just try to open it with PIL
from PIL import Image from cStringIO import StringIO try: image = Image.open(StringIO(request.FILES['picture'] ['content'])) except: # raise error here In practice, I handle pictures in views because there are less constraints. All the pictures are saved in JPEG and the filename is a combination of the md5 and sha hexdigest import md5, sha picture_hash = "%s%s" % ( md5.new(picture['content']).hexdigest(), sha.new(picture['content']).hexdigest()) picture_filename = "%s.jpg" % picture_hash[4:] picture_path = "/media/pic/%s/%s/" % (picture_hash[:2], picture_hash[2:4]) This way the same picture never gets written twice. I have a model for the picture with methods like get_url() and get_file() On 25 mai, 11:29, Christian Schmidt <[EMAIL PROTECTED]> wrote: > ok, thats the fact. But I can not imagine whats wrong in my code. I > have nearly copy and paste all of it from > > http://www.oluyede.org/blog/2007/03/18/django-image-uploading-validat... > > There, it seems to work... how do you validate files or images with > django newforms? Is there something strange in the way I do it or does > something special changed in the django svn repo? > > In my opinion the code seems to be neary similar > tohttp://www.djangosnippets.org/snippets/95/ > I've no idea what went wrong. > > Regards, > Christian --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---