Cmultifileupload Not Working When Htmloptions Are Set

I am working on multiple file uploads using CMultiFileUpload like shown on the view form below.




<div class="form">


<?php $form=$this->beginWidget('CActiveForm', array(

	'id'=>'postads-form',

	'enableClientValidation'=>true,

	'clientOptions'=>array(

		'validateOnSubmit'=>true,

	),

	'action' => Yii::app()->createUrl('mytest/upload'),

	'htmlOptions' => array('enctype' => 'multipart/form-data'),

	

)); ?>

...


<div class="row">

		<?php echo $form->labelEx($picha,'images'); ?>

		 <?php 

			$this->widget('CMultiFileUpload', array(

                'model'=>$picha,

		'attribute'=>'images',

		'accept'  => 'gif|jpg|png', 

                'max'	 => 10,

                'duplicate' => 'Duplicate file!', 

                'denied' => 'Invalid file type',

		'options'=>array( ),

            ));

			?>          

		<?php echo $form->error($picha,'images'); ?>




In the controller this is what i have, it’s not complete i


public function actionUpload(){

		

		$ckimg  = new CkImages;

			

			

		if (isset($_POST['CkImages'])) {	

		

		    $ckimg->attributes = $_POST['CkImages'];

      		   var_dump($ckimg->attributes);

                }

     }

$_POST does not work when i have ‘htmlOptions’ => array(‘enctype’ => ‘multipart/form-data’), set. When i comment it

POST is working but i need it in order to access the files.

Has anyone ever encountered such a strange behavior and how do you solve it.

I followed a suggestion stackoverflow

php - Yii multiple file upload - Stack Overflow:

where somebody had made an observation that "only having the MultiFileUpload widget specified on the form somehow fails to create the $_POST object? Once I added a second input field it all worked as expected"

I tried it and somehow it works. How and why it works in this mannerism is still a puzzle.