CUploadedFile and Ajax

Hello

This my view/form :


....

 echo $form->fileFieldRow($model, 'uploaded_file', array('class' => 'span5'));

....

<?php

$this->widget('bootstrap.widgets.TbButton', array(

    'buttonType' => 'submit',

    'type' => 'primary',

    'label' => $model->isNewRecord ? 'Create' : 'Save',

));

?>

<?php

echo '&nbsp;';

    echo CHtml::ajaxSubmitButton(

                            'Save and continue >', 'createajax', array(

                        

                            ), array(

                        'id' => 'assign-row-button_' . uniqid(),

                        'class' => 'btn btn-info assign_row',

                        'live' => true

                    ));

?>  

Controller :


public function actionCreate(){

$model=new FiFiles;

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

..


$file = CUploadedFile::getInstance($model, 'uploaded_file');  //Here It is WORKING!

...

}

}

But when I am using Ajax :


 public function actionCreateAjax() {


      $model=new FiFiles;

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


 $file = CUploadedFile::getInstance($model, 'uploaded_file'); //HERE IS NULL!!

}

}



Can Anyone Help please

If you want to send files with ajax, you need to manualy add file to the sended data via FormData.

Would you please give me an exemple?