Cant Upload Pdf File

yii-1.1.14.f0fee9.tar.gz i am new but i am not sure why i cant upload file, it shows me "no file selected message" if i put the wrong filename type it validates but with pdf nothing

this are my files:

controller:

public function actionCreate()

{


    $model=new Files;      





    // Uncomment the following line if AJAX validation is needed


    // $this->performAjaxValidation($model);





    if(isset($_POST['Files']))      


    {


        $model->attributes=$_POST['Files'];


        $filename = CUploadedFile::getInstance($model, 'path');


        if ($filename !== null )        


        {                  


            $rfname = rand(0, 9999) . $filename;


            $model->path = $rfname;         


        }


        if($model->save()) {            


            if ($filename !== null)         


            {              


                $path = Yii::app()->basePath . '/../pdfs/' . $rfname;


                $model->path->saveAs($path);    


            }              


            $this->redirect(array('view','id'=>$model->id));


        }                  


    }


  


    $this->render('create',array(   


        'model'=>$model,   


    ));


} 

model:

public function rules()

{   


    // NOTE: you should only define rules for those attributes that


    // will receive user inputs.


    return array(


        array('name, initial_date, end_date, product_id', 'required'),


        array('path', 'file', 


        'allowEmpty'=>true, 


        'types'=> 'pdf',


        'maxSize' => 1024*1024* 10, // 10MB


        'tooLarge' => 'File very big',


        'wrongType' => 'Debe ser un archivo pdf'),


        array('product_id', 'numerical', 'integerOnly'=>true),


        array('name', 'length', 'max'=>128),


        // The following rule is used by search().


        // @todo Please remove those attributes that should not be searched.


        array('id, name, initial_date, end_date, product_id', 'safe', 'on'=>'search'),


    );  


}   

and _form.php

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

'id'=&gt;'files-form',


// Please note: When you enable ajax validation, make sure the corresponding


// controller action is handling ajax validation correctly.


// There is a call to performAjaxValidation() commented in generated controller code.


// See class documentation of CActiveForm for details on this.


'enableAjaxValidation'=&gt;false,


'htmlOptions'=&gt;


    array( 'enctype' =&gt; 'multipart/form-data'),

)); ?>

<div class="row">

    &lt;?php echo &#036;form-&gt;labelEx(&#036;model,'path'); ?&gt;


    &lt;?php echo &#036;form-&gt;fileField(&#036;model, 'path'); ?&gt;


    &lt;?php echo &#036;form-&gt;error(&#036;model, 'path'); ?&gt;


&lt;/div&gt;

what could be wrong?

wtf


$rfname = rand(0, 9999) . $filename; // string

$model->path = $rfname; // string

$model->path->saveAs($path);  // object?..



what do you mean? $path is also a string

if $model->path is a string, then what will be the result of $model->path->saveAs()?

ah my mistake ok, but the same problem… it doesnt even enter the post it seems

    if(isset(&#036;_POST['Files']))


    {   


         echo &quot;this isnt shown&#33;&quot;


         exit;


        &#036;model-&gt;attributes=&#036;_POST['Files'];


        &#036;filename = CUploadedFile::getInstance(&#036;model, 'path');


        if (&#036;filename &#33;== null )


        {   


            &#036;rfname = rand(0, 9999) . &#036;filename;


            &#036;model-&gt;path = &#036;rfname;


        }   


        if(&#036;model-&gt;save()) {


            if (&#036;filename &#33;== null)


            {   


                &#036;path = Yii::app()-&gt;basePath . '/&#46;&#46;/pdfs/' . &#036;rfname;


                &#036;filename-&gt;saveAs(&#036;path);


            }   


            &#036;this-&gt;redirect(array('view','id'=&gt;&#036;model-&gt;id));


        }   


    }   





    &#036;this-&gt;render('create',array(


        'model'=&gt;&#036;model,


    )); 


}