How to make CActiveForm of enctype multipart/form-data

How to get my form posted to type of enctype multipart/form-data

My _form has

<?php $form=$this->beginWidget(‘CActiveForm’, array(



)); ?>

inside htmlOptions add the enctype tag

<?php $form=$this->beginWidget('CActiveForm', array(




)); ?>

Is this right?

look at the documentation, matbe it is stand alone array

You must know that every widget - if you want to set it params it is the second param in the form of array.

widget(‘className’, array params)


I had the same problem.

CUploadedFile::getInstance($model, ‘filename’);

was always returning null and saveAs(); said I was trying to call it on a non-object.



solved the problem.

Thank you.