CMultiFileUpload not working if max=0

I’m using CMultiFileUpload widget the normal way and it’s working fine but I sometimes don’t able users to upload files; that’s when $max=0. But when that happen they can upload unlimited files!

So how to make this widget not to be able to accept files to uplooad?




$this->widget('CMultiFileUpload', array(

                'name' => 'images',

                'max'=>$mx, // not wrking if $max=0

                'accept' => 'jpeg|jpg|gif|png', 

                'duplicate' => 'Duplicate file!',

                'denied' => 'Invalid file type', 

            ));



Hey,

How about using the htmlOptions disabled attribute to disable the input.




$this->widget('CMultiFileUpload', array(

                'name' => 'images',

                'max'=>$mx, // not wrking if $max=0

                'accept' => 'jpeg|jpg|gif|png', 

                'duplicate' => 'Duplicate file!',

                'denied' => 'Invalid file type', 

                'htmlOptions' => array('disabled' => (0 === $mx ? true : false)),

            ));



Yes, working…

I undestand much this way




$this->widget('CMultiFileUpload', array(

                'name' => 'images',

                'max'=>$mx, // not wrking if $max=0

                'accept' => 'jpeg|jpg|gif|png', 

                'duplicate' => 'Duplicate file!',

                'denied' => 'Invalid file type', 

                'htmlOptions' => array('disabled' => ($mx==0 ? true : false)),

            ));