clevertech/YiiBooster — pull request #188 by DonFelipe (2012-12-14 06:47:39+00:00)
Title: TbFileUpload + check for options in model's rules if not set otherwise

if the options (acceptedFileTypes and maxFileSize) are not set via the widget call; the widget will check in the model's validation rules.

few comments:
- no need to do further check if model/attribute exists as it's done by $this->resolveNameID();
- one could have shorten the syntax a bit but i do prefer the clean and more readable approach
- vice versa? i don't think it's necessary to add these option to the model's validation (if set via widget and not set in rules) as validation will mainly and first be done by the widget; besides the acceptedFileTypes value can/is a regex; of course it can be processed... but it seems to be too much ado about...

as it is right now, one can set the rules in model and/or the widget

last not least, in case fileSize is not set on either side, one could get the maximum size allowed per upload from php.ini.... let me know.