Cmultifileupload

Dear all

I need some help immediately, i have try CMultiFileUpload to upload multiple file into my database, but the problem is the file is store into directory but the database still empty, does anyone know why this happen?

herewith my form source:

<?php echo $form->labelEx($model,‘attachment’); ?><br />

 &lt;?php &#036;this-&gt;widget('CMultiFileUpload', array(


     'name' =&gt; 'attachment',


     'accept' =&gt; 'jpeg|jpg|gif|png|pdf|doc|docx|xlx|xlsx|zip|rar',


     'duplicate' =&gt; 'Duplicate file&#33;',


	 'remove'=&gt;Yii::t('ui','Remove &lt;--'),


     'denied' =&gt; 'File Is Not Allowed, Upload Only: jpeg,jpg,gif,png,pdf,doc,docx,xlx,xlsx,zip,rar',


 ));?&gt;

<?php echo $form->error($model,‘attachment’); ?>

my model source:

array(‘attachment’, ‘file’,

‘types’=>‘jpeg,jpg,gif,png,pdf,doc,docx,xlx,xlsx,zip,rar,rtf,ppt,pptx,txt’, ‘allowEmpty’=>true, ‘on’=>‘insert,update’),

array(‘title, attachment’, ‘length’, ‘max’=>255, ‘on’=>‘insert,update’),

and my controller source:

public function actionCreate()

{


	


	&#036;model=new Content;





	// Uncomment the following line if AJAX validation is needed


	// &#036;this-&gt;performAjaxValidation(&#036;model);





	if(isset(&#036;_POST['Content']))


	{


		&#036;model-&gt;attributes=&#036;_POST['Content'];


		 &#036;images = CUploadedFile::getInstancesByName('attachment');


       if(isset(&#036;images) &amp;&amp; count(&#036;images) &gt; 0) 


        {


            foreach (&#036;images as &#036;i=&gt;&#036;ii) 


            {


			//echo &#036;ii -&gt;name. '&lt;br /&gt;';


			if (&#036;ii-&gt;saveAs(Yii::getPathOfAlias('webroot').'/images/'.&#036;ii-&gt;name)) 


				{


            &#036;img_add = new Content();        


			&#036;img_add-&gt;attachment = &#036;ii-&gt;name;		


			//&#036;img_add-&gt;topic_id = &#036;model-&gt;idpropinsi;


			&#036;img_add-&gt;save();


				}


                else


            &#036;img_add = new Content();        


			&#036;img_add-&gt;attachment = &#036;ii-&gt;name;		


			//&#036;img_add-&gt;topic_id = &#036;model-&gt;idpropinsi;


			&#036;img_add-&gt;save();


            //}		


					


					





        if(&#036;model-&gt;save()) 


				{


		&#036;this-&gt;redirect(array('view','id'=&gt;&#036;model-&gt;id));


         


        			}


				}


		}


	}


	&#036;this-&gt;render('create',array(


		'model'=&gt;&#036;model,


	));


	


	}

Somebody help me please, today is my deadline for my homework