submit filefield using ajax

Hi there, i need to submit a form with filefield using ajax. am gettng CUploadFile instance blank when i try submitting…

Basic sintax for ajax call is given by the following code:


            type: 'POST',


            url: 'TYPE HERE YOUR AJAX URL',

            data:{username: 'test.user', password:'my password'},


                alert('This functionis called if AJAX call was successful');


            error: function(data) { // if error occured

                alert('This function is called if AJAX call was unsuccessful');



Now in your yii action you can get these variables using:

$username = Yii::app()->request->getParam('username');

$password = Yii::app()->request->getParam('password');