Yii Framework Forum: Facing enctype problem in CActiveForm - Yii Framework Forum

Jump to content

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

Facing enctype problem in CActiveForm Facing enctype problem in CActiveForm Rate Topic: -----

#1 User is offline   Mohsin Shoaib 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 25-April 11
  • Location:Pakistan

Posted 04 May 2011 - 07:24 AM

Please I need help..

How can i set enctype='multipart/form-data' in below CActiveForm? I want to upload some files.

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'projects-form',
	'enableAjaxValidation'=>false,
)); ?>


I tried to use
<?php echo CHtml::form('','post',array('enctype'=>'multipart/form-data')); ?>


But as my rules are coming from model and other stuff so it did not work for me... Also i am using CMultiFileUpload for uploading multiple files..


Any idea ???
0

#2 User is offline   Mohsin Shoaib 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 25-April 11
  • Location:Pakistan

Posted 04 May 2011 - 07:38 AM

Nobody..... :(
0

#3 User is offline   Mohsin Shoaib 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 25-April 11
  • Location:Pakistan

Posted 04 May 2011 - 07:46 AM

Get solution. We have to add htmloptions in CActiveform for this purpose
Like this.

<?php $form=$this->beginWidget('CActiveForm',  array(
	'id'=>'projects-form',
	'enableAjaxValidation'=>false,
        'htmlOptions' => array(
            'enctype' => 'multipart/form-data'
        )
)); ?>

:)
0

#4 User is offline   xtremagix 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 06-May 11

Posted 08 May 2011 - 11:50 PM

here's more complete explanation about uploading file with CActiveForm

http://www.yiiframework.com/wiki/2/
There's no such thing of Individualism, Sharing with others is how you respect the knowledge itself...
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