Problem file validation (on update) - Yii 1.1.16


(Devjrb) #1

Since I’ve updated to 1.1.16, the file validation (only on update) not pass the rule. When I return to 1.1.15, it works. Anyone more?


(Maurizio Domba Cerin) #2

See if this can help you - https://github.com/yiisoft/yii/issues/3672


(Javierleal) #3

Which is the solution finally? In the issues have no solution.


(Saurabhdhariwal737) #4

There are 2 solutions for this problem as follows:

  1. Model (Add following rule in model rules).

array('file_name', 'required', 'on'=>array('update')),

  1. Controller (Add following code in your update action).

$fileInstance = CUploadedFile::getInstance($model, 'file_name');

        if (!empty($fileInstance)) {

                //then save your file

        }

Hope this helps you.

Thanks!


(Alexander Makarov) #5