开发者

Fail validation if one rule for any field fails

How do you make validation in CakePHP stop if any single rule fails for any field?

开发者_如何学JAVAI know about the 'last' property but that only stops validation for that field, I want it to stop completely.

Thanks.


I was validating a picture upload in the model and then uploading it there and creating a user folder for the photo. Obviously I didn't know the user ID if the record failed the photo validation so the folder couldn't be created.

I have modified my validation to validate the upload and added a reference to the temporary uploaded file within the model class. I then wrote a custom afterSave() function to check if the user had uploaded an image when they registered, and if so to create the appropriate folders and move the image to a permanent location.

Thanks for the help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜