Yii Framework Forum: Filefieldrow And Validation Don't Work - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Filefieldrow And Validation Don't Work Rate Topic: -----

#1 User is offline   nath-0 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 12-October 12
  • Location:switzerland

Posted 15 March 2013 - 01:03 PM

Hello,

i use :
<?php echo $form->fileFieldRow($model,'cours_source',array('tabIndex'=>3,)); ?>


controller:
...
  $model->cours_source=CUploadedFile::getInstance($model,'cours_source');
               
                $model->cours_pdf=CUploadedFile::getInstance($model,'cours_pdf');
                if($model->save()) {
                    if ($model->cours_source !== null){
                        $model->cours_source->saveAs(Yii::app()->params['qyiiPathStorage']);
                    }
                    if ($model->cours_pdf !== null){
                        $model->cours_pdf->saveAs(Yii::app()->params['qyiiPathStorage']);
                    }
...


model
return array(
			array('fk_formation_id, version, commentaire', 'required'),
            array('cours_source', 'file', 'types'=>'txt','allowEmpty'=>false,),
            array('cours_pdf', 'file', 'allowEmpty'=>false,'types'=>'pdf'),
			array('is_actif', 'numerical', 'integerOnly'=>true),
			array('cours_source, cours_pdf, cours_url', 'length', 'max'=>255),
			array('version', 'length', 'max'=>25),
			  array('cours_source,cours_pdf', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('fk_formation_id, is_actif, freeSearch', 'safe', 'on'=>'search'),
		);


The model summry tell me that I Have to choose a file even If I choosed one !

Any ideas?

Thank

NAth
0

#2 User is offline   nath-0 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 12-October 12
  • Location:switzerland

Posted 18 March 2013 - 03:47 AM

nobody ?

I look in the web for hours, I don't find solution... :wacko:
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users