Version 3 (modified by anonymous, 17 years ago) (diff)


CookBook - Validate an image weight

django version : 0.91

To check the weight an image uploaded via your form, you can implement this method into your or custom manipulator.


Here we check that the image under 100 kb.

def isValideSize(field_data, all_data):
        if len(field_data["content"]) > 100000: # 100,000 bytes 
                raise validators.ValidationError, "File is too large"
Back to Top