how to upload a file with CJuiDialog

How do I upload a file with CJuiDialog and show the uploaded file name at yii mvc?

this my view


<?php


$this->beginWidget('zii.widgets.jui.CJuiDialog', array(

    'id'=>'mydialog',

    // additional javascript options for the dialog plugin

    'options'=>array(

        'title'=>'Dialog box 1',

        'autoOpen'=>false,		

    ),

));

?>

<script type="text/javascript">

 function sub()

 {

  alert ("MIC!");

  return false;

 }

</script> 

<form id="test" onsubmit="return sub();">

file <input type="file" name="file" />

name <input type="text" name="name" />

<input type="submit" on  />


</form>


<?php

$this->endWidget('zii.widgets.jui.CJuiDialog');


// the link that may open the dialog

echo CHtml::link('open dialog', '#', array(

   'onclick'=>'$("#mydialog").dialog("open"); return false;',

));


?>