How to use xupload

Hi all.

I am new to Yii and want to integrate file uploading.Unfortunately I have not been able to make it work.I have downloaded and extracted the plugin to /extensions/ folder but now I do not know what to do.

Can some one guide me?

You just have to use


$this->widget('ext.xupload.XUploadWidget', array(

                    'url' => Yii::app()->createUrl("site/upload"),

                    'model' => $model,

                    'attribute' => 'file',



in the view file.

it says Undefined variable: model

Well, this depends on your Controller Action. By default gii/yiic creates something like this:




Were model is an instance of an ActiveRecord.

You could also take a look at this wiki article which explains file upload with a model. (For "simple" file uploads although.)