Cuploadfile::getinstance Allway Return Array

hi you, I am using CUploadedFile::getInstance to upload a image, but it allways to return array into propety of model.

Here my code general by gii tool :




class AddImage extends CFormModel{

	public $type;

	public $image;

	const TYPE_THUMBNAIL = 0;

	const TYPE_DETAIL = 1;

	public function rules(){

		return array(

			array('type','required'),

			array('image','file','types'=>'jpeg, jpg, png, gif'),

		);

	}

	

}



My View




<?php

/* @var $this AddImageController */

/* @var $model AddImage */

/* @var $form CActiveForm */

?>


<div class="form">


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

	'id'=>'add-image-addimage-form',

	'enableAjaxValidation'=>false,

	'enableClientValidation'=>true,

	'htmlOptions'=>array(

			'enctype'=>'multipart/form-data',

	)

)); ?>


	<p class="note">Fields with <span class="required">*</span> are required.</p>


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


	<div class="row">

		<?php echo $form->labelEx($model,'type'); ?>

		<?php echo $form->textField($model,'type'); ?>

		<?php echo $form->error($model,'type'); ?>

	</div>

	

	<div class="row">

		<?php echo $form->labelEx($model,'image'); ?>

		<?php echo $form->fileField($model,'image'); ?>

		<?php echo $form->error($model,'image'); ?>

	</div>


	<div class="row buttons">

		<?php echo CHtml::submitButton('Submit'); ?>

	</div>


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


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


And var_dump($model->image)

[code]

array (size=1)

  0 => 

    object(CUploadedFile)[31]

      private '_name' => string 'default.jpeg' (length=12)

      private '_tempName' => string 'C:\EasyPHP\tmp\phpB6.tmp' (length=24)

      private '_type' => string 'image/jpeg' (length=10)

      private '_size' => int 7484

      private '_error' => int 0

      private '_e' (CComponent) => null

      private '_m' (CComponent) => null



[/code]

sorry i find my error : using getInstance to return object, and getInstances return array

Exactly, I just fixed same bug in the code. see document about CUploadedFile

http://www.yiiframework.com/doc/api/1.1/CUploadedFile/

getInstance() Returns an instance of the specified uploaded file.

getInstanceByName() Returns an instance of the specified uploaded file.

getInstances() Returns all uploaded files for the given model attribute.

getInstancesByName() Returns an array of instances starting with specified array name.