Problem with tabular Inputs with JQRelcopy

Hi all I am using JQRelcopy .It works fine if all inputs are textfields. Now I have one text field and one filefield. I know it is necessary to use


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

it works pretty well if it is single file and this extension is NOT used. How ever I have following issues

1.If you use ‘htmlOptions’ => array(‘enctype’ => ‘multipart/form-data’), image data is not sent to _POST

2.If you do not use data is there.

3.CVarDumper for _POST is


array

(

    'title' => array

    (

        '0' => 'qwe'

        '1' => 'asd'

    )

    'image' => array

    (

        '0' => 'IMG_23012012_122202.png'

        '1' => 'IMG_23012012_194652.png'

    )

)

4.Everything is fine if I access above but


$model->image = CUploadedFile::getInstance($model, $formData['image'][$idx]);

returns null


$formData['image'][$idx]

returns filename of image

Following is complete code

FORM


<div class="form">


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

	'id'=>'hotel-images-form',

	'enableAjaxValidation'=>false,

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

)); ?>


	<?php echo $form->errorSummary($model); ?>


        <?php

        $this->widget('ext.jqrelcopy.JQRelcopy',

                array(

                    'id' => 'copylink',

                    'removeText' => 'remove' //uncomment to add remove link                    

                    ));

        ?>

        <a id="copylink" href="#" rel=".copy">Copy</a>    


        <div class="row copy">

            <?php        

            echo CHtml::label('Image Title',''); ?>

            <?php echo CHtml::textField('HotelImages[title][]',''); ?>

            <?php echo CHtml::FileField('HotelImages[image][]', ''); ?>

        </div>




	<div class="row buttons">

		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>

	</div>


<?php $this->endWidget(); ?>


</div><!-- form -->

CONTROLLER


 

protected function saveImage($formData,$id,$model)

        {

            if ($formData === null)

                return;


                $idx=0;

    foreach($formData['title'] as $image)

            {

                $model->title = $image;

                echo CVarDumper::dumpAsString($formData, 100, true);

		yii::app()->end();

                $model->image = CUploadedFile::getInstance($model, $formData['image'][$idx]);

                echo CVarDumper::dumpAsString($model->image, 100, true);

		yii::app()->end();

                $file= dirname(Yii::app()->request->scriptFile) . DIRECTORY_SEPARATOR . $model->image;

                if($model->save())

                       {

                           If(file_exists($file)) 

                           {

                               $model->image->saveAs($file.DIRECTORY_SEPARATOR.$formData['image'][$idx]);

                           }

                           else

                           {

                               mkdir($file); 

                               $model->image->saveAs($file.DIRECTORY_SEPARATOR.$formData['image'][$idx]);

                           }

                       }

                       else{

                           print_r($model->getErrors());

                           return FALSE;

                       }

                           $idx++;

            }

                return true;

        }



Check two placed for image data:

File meta data can be stored in a global variable called $_FILES.

The actual image will be stored in a temp directory (likely /tmp).

_FILES is empty array