there is aproblem with my code here
iam trying to make multi uploaded files(images)
but there is some thing wrong here :
My view :
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'u-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
'htmlOptions' => array( 'enctype' => 'multipart/form-data'),
),
)); ?>
<?php echo $form->labelEx($model,'image'); ?>
<?php
$this->widget('CMultiFileUpload', array(
'model'=>$model,
'attribute'=>'image',
'accept'=>'jpg|gif|png',
));
?>
<?php echo $form->error($model,'image'); ?>
<?php echo CHtml::submitButton( 'Submit'); ?>
<?php $this->endWidget(); ?>
____________________________________________________________________________________________
My controller:
public function actionIndex()
{
$model=new Photo();
// Uncomment the following line if AJAX validation is needed
//$this->performAjaxValidation($model);
if(isset($_POST['Photo']))
{
$model->attributes=$_POST['Photo'];
$images = CUploadedFile::getInstances($model,'iamge');
var_dump($images);
if(isset($images) && count($images)> 0)
{
foreach ($images as $image=>$pic)
{
if ($pic->saveAs(Yii::getPathOfAlias('webroot').'/images/'.$pic->name,0777))
{
$model->setIsNewRecord(true);
$model->id = null;
$model->image = $pic->name;
$model->save();
}
}
$this->redirect(array('view','id'=>$model->id));
}
}
$this->render('index',array(
'model'=>$model,
));
}
whats wrong with that <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />