Using Django svn r8463 I have the following model: class Image(models.Model): description = models.CharField(max_length=100) image = models.ImageField(upload_to='images')
...and view: def upload_image(request): upFile = request.FILES['file'] newImage = Image() newImage.image.save(upFile.name, upFile, save=True) return HttpResponse("OK: %s}" %newImage.image.url, mimetype='text/ html') The 'upload_image' view is run by an AJAX call (no HTML form). The Django documentation at: http://www.djangoproject.com/documentation/model-api/#imagefield states that 'ImageField' field type is "Like FileField, but validates that the uploaded object is a valid image". However when using the above code it allows me to upload any file type I like (not just images) without any exceptions being raised. What am I missing? Is this a consequence of http://code.djangoproject.com/changeset/8348 or should I be doing something else to enable this validation? (I have PIL installed). Would it be preferable to use a Django form for the image upload & would it make any difference? Thanks, Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---