clevertech/YiiBooster — pull request #196 by DonFelipe (2012-12-18 15:55:42+00:00)
Title: Update widgets/TbFileUpload.php

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.