Changes between Version 3 and Version 4 of CookBookValidateImageWeight
- Timestamp:
- Jul 25, 2006, 10:24:31 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBookValidateImageWeight
v3 v4 1 1 = CookBook - Validate an image weight = 2 django version : 0.91 2 3 django version : POST-MR 3 4 4 5 To check the weight an image uploaded via your form, you … … 10 11 #!python 11 12 def isValideSize(field_data, all_data): 13 if len(all_data["image_file"]["content"]) > 100000: # 100,000 bytes 14 raise validators.ValidationError, "File is too large" 15 }}} 16 17 ---- 18 19 == Older versions of Django == 20 21 django version : 0.91 22 23 == Code == 24 Here we check that the image under 100 kb. 25 {{{ 26 #!python 27 def isValideSize(field_data, all_data): 12 28 if len(field_data["content"]) > 100000: # 100,000 bytes 13 29 raise validators.ValidationError, "File is too large"