Yii框架CMultifileupload不工作

Yii框架CMultifileupload不工作,yii,Yii,我正在尝试使用CMultiFileUpload和cuploaddedfile实现多文件上传,但它不起作用。具体来说,_POST即使考虑到我在视图的选项中使用了'enctype'=>'multipart/form data',也不起作用: <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'examen-form', 'enableAjaxValidation'=>false, 'h

我正在尝试使用CMultiFileUpload和cuploaddedfile实现多文件上传,但它不起作用。具体来说,_POST即使考虑到我在视图的选项中使用了'enctype'=>'multipart/form data',也不起作用:

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'examen-form',
    'enableAjaxValidation'=>false,
    'htmlOptions' => array('enctype' => 'multipart/form-data'),

我认为问题出在post方法中,因为控制器没有上传文件,也没有对数据库进行任何更改。但我不确定。

尝试更改为
'htmlOptions'=>array('multiple'=>true)
在表单中添加以下代码

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


我使用的是同一个扩展名,它为我提供了这些代码 在视图文件中

<?php $form = $this->beginWidget('CActiveForm', array(
'id'=>'adpost-form',
'enableClientValidation'=>true,
'clientOptions' => array(
     'validateOnSubmit'=>true,
     'validateOnChange'=>false,
     'afterValidate'=>'js:submiAjaxForm'
 ),
'htmlOptions' => array('enctype' => 'multipart/form-data'),
array('archivo_foto','file','allowEmpty'=>true,'maxFiles'=>10),
'htmlOptions' => array(
            'enctype' => 'multipart/form-data',
        ),
<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'form',
    // Please note: When you enable ajax validation, make sure the corresponding
    // controller action is handling ajax validation correctly.
    // There is a call to performAjaxValidation() commented in generated controller code.
    // See class documentation of CActiveForm for details on this.
    'enableAjaxValidation'=>true,

     'htmlOptions' => array(
        'enctype' => 'multipart/form-data',
    ),
)); ?>
<?php $form = $this->beginWidget('CActiveForm', array(
'id'=>'adpost-form',
'enableClientValidation'=>true,
'clientOptions' => array(
     'validateOnSubmit'=>true,
     'validateOnChange'=>false,
     'afterValidate'=>'js:submiAjaxForm'
 ),
'htmlOptions' => array('enctype' => 'multipart/form-data'),
<?php
                $this->widget('CMultiFileUpload', array(
                    'name' => 'photo_name',
                    'accept' => 'jpeg|jpg|gif|png',
                    'duplicate' => 'File is not existed!',
                    'denied' => 'Not images', // useful,
                    'htmlOptions' => array(
                        'style' =>'color: transparent;',
                    ),
                ));
                ?>
$images = CUploadedFile::getInstancesByName('photo_name');
foreach ($images as $image => $pic) {

                        //----------------- Renaming image before uploading

                        $extension      =   $pic->getExtensionName();
                        $newName    =   "image_".$adModel->id;
                        $newName                .=  "_".$imgCount.".".$extension;
                        $imgCount++;

                        if ($pic->saveAs($newPath.$newName)) {
                            // add it to the main model now
                            $img_add             = new AdsPhotosTbl;
                            $img_add->photo_name = $newName;
                            $img_add->ad_id      = $adModel->id;   
                            $img_add->status     = 1;
                            if(!$img_add->save()){
                                $error           =   true;
                                $upload_error    =   true;
                                break;
                            } 
                        }else{
                            $upload_error       =   true;
                            $error              =   true;
                            break;
                        }
                    }