where can i add my image validation code excluding 'on_after_post' function.?

edited April 2013 in Modules
where can i add my image validation code excluding 'on_after_post' function.?

Comments

  • edited 11:45AM
    The on_after_post model callback is intended for things like that. Why aren't you wanting to use it there?
  • edited 11:45AM
    But i don not want to save data if my validation code generates any error.
  • edited 11:45AM
    I have used $this->add_error method in my validation code but in get_errors() i am getting empty values ...or is there any other way to get all the errors?

    So based on the errors i will process the saved data.
  • edited 11:45AM
    The on_after_post hook happens after the save and is also when the image processing of uploaded files happens. So if you need to run image validation before saving, then you'll need to create an on_before_validate hook to process/validate the image. If there is an error, then the add_error method should prevent it from saving at that point.
  • edited 11:45AM
    ok, Thanks
Sign In or Register to comment.