Trying to upload a file

I’m trying to perform a simple file upload. In my model I have:




<?

class UploadForm extends CFormModel

{

  public $image;


  public function rules()

  {

    return array(

      array('image', 'file', 'types'=>'jpg,jpeg,gif,png', 'maxSize'=>30720),

      array('image', 'required'),

    );

  }

}

?>



My controller:




<?

class UploadController extends Controller

{


  public function actionIndex()

  {

      $model=new UploadForm();

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

      {

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

        $model->image = CUploadFile::getInstance($model, 'image');

        if ($model->save())

        {

          $model->filename->saveAs('/tmp/uploads/test.txt');

        }          

      }

      

      $this->render('Upload',array('model'=>$model));

  }

}

?>



My view:




<div class="form">

<?php //echo CHtml::beginForm(); ?>

 

 

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


        <?php echo CHtml::activeLabel($model,'image'); ?>

        <?php echo CHtml::activeFileField($model, 'image'); ?>


        <?php echo CHtml::submitButton('UPLOAD'); ?>


    <?php echo CHtml::endForm(); ?>

    

<?php //echo CHtml::endForm(); ?>

</div><!-- form -->



When I select a file to upload and press the upload button, I get:

include(CUploadFile.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

Please help - desperate…

CUploadedFile

you have mistake in classname