I want to use upload multiple with xupload extension,
but didn't work my code?
此配置
的config.php
'aliases'=&gt; array(//如果您使用了composer,那么您的路径应该是 'xupload'=&gt; 'ext.vendor.Asgaroth.xupload', //如果您手动安装它 'xupload'=&gt; '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
but don't work, please help to solve my problem,
thanks ?
答案 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,
)); ?>