如何使用xupload yii扩展

时间:2013-05-06 16:15:44

标签: jquery jquery-ui-dialog yii-extensions multifile-uploader yii-xupload

I want to use upload multiple with xupload extension,
but didn't work my code?

此配置

  

的config.php
           'aliases'=> array(//如果您使用了composer,那么您的路径应该是                         'xupload'=> 'ext.vendor.Asgaroth.xupload',                         //如果您手动安装它                         'xupload'=> 'ext.xupload',),

     and  the Widget in views 
    <?php   $this->widget('xupload.XUpload', array(
                        'url' => Yii::app()->createUrl("site/upload"),
                        'model' => $model,
                        'attribute' => 'file',
                        'multiple' => true,
    ));  ?>
     and controller
    class SiteController extends CController
    {
        public function actions()
        {
            return array(
                'upload'=>array(
                    'class'=>'xupload.actions.XUploadAction',
                    'path' =>Yii::app() -> getBasePath() . "/../uploads",
                    'publicPath' => Yii::app() -> getBaseUrl() . "/uploads",
                ),
            );
        }
    }
and this view my application  

enter image description here

but don't work, please help to solve my problem,
thanks ?

此示例:http://blueimp.github.io/jQuery-File-Upload/

2 个答案:

答案 0 :(得分:0)

小部件无法嵌套在表单中。移动它我们的形式,它将工作。

答案 1 :(得分:0)

更改小部件代码。使用'showForm'=&gt; false选项和set id相同,就像你的主表单有'htmlOptions'=&gt;阵列( 'ID'=&GT; '您的-主要形式-ID',)。它将在您的表单中工作。

<?php   $this->widget('xupload.XUpload', array(
                    'url' => Yii::app()->createUrl("site/upload"),
                    'htmlOptions' => array('id'=>'your-main-form-id',),
                    'model' => $model,
                    'attribute' => 'file',
                    'multiple' => true,
                    'showForm' => false,
));  ?>