upload file

I am trying to upload a file with CActiveForm but when I write


there is an empty array.

what is wrong?

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



    'htmlOptions' =>array(type=>"multipart/form-data" )

)); ?>....

<?php echo $form->fileField($model,'title'); ?>

I solve that problem but now the file is not uploaded.

And also I have the error

Ind_pdfController does not have a method named "addError".

what is wrong?

$model=new ind_pdf;


 if(isset($_POST['ind_pdf'])) {




            $Upload = new Upload( (isset($_FILES['ind_pdf']['title']) ?$_FILES['ind_pdf']['title']  : null) );

            $destPath = Yii::app()->getBasePath().'/../pdf/';


            if ($Upload->processed) {

                $model->title = $Upload->file_dst_name;






[EDIT] I solved it .

Yeah, please, could you tell us how did you solve the problem ?

 $destPath = Yii::app()->getBasePath().'/../pdf/';

Problem was in destination path this is not alowed

I´ve solved the problem with the empty array by changing $_POST to $_FILES

Here is a tutorial.

I used it and I do a custom validation if needed, checking the $_FILES array because I had the "Image cannot be blank" problem as mentioned there.