Try like this normal way
CHtml::fileField('name' , 'value', array('id' => 'MuID','class'=>'MyClass'));
If you sending the model data to the View, you can use CActiveForm
(check the basic CRUD operations in YII, Generate from GII)
Example:
i have fetched user data which has id 0001 and i sent the model to the view
My View
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'my-form',
'enableAjaxValidation' => true,
'enableClientValidation' => true,
'clientOptions' => array(
'hideErrorMessage' => true,
'validateOnSubmit' => true,
)
));
?>
//It will show user name in textbox
<?php echo $form->fileField($model, 'user_name'); ?>
<?php $this->endWidget(); ?>