我有这个 xupload 文件扩展名:
<?php
$this->widget( 'xupload.XUpload', array(
'url' => Yii::app( )->createUrl( "/controller/upload"),
'model' => $model,
'htmlOptions' => array('id'=>'somemodel-form'),
'attribute' => 'file1',
'multiple' => true,
'formView' => 'application.views.somemodel.form1',
'uploadView' => 'application.views.somemodel.upload1',
'downloadView' => 'application.views.somemodel.download1',
'options' => array(//Additional javascript options
//This is the submit callback that will gather
//the additional data corresponding to the current file
'submit' => "js:function (e, data) {
var inputs = data.context.find(':input');
data.formData = inputs.serializeArray();
return true;
}"
),
)
);
?>
我需要添加另一个上传文件字段,但是当我复制这样的代码时:
<?php
$this->widget( 'xupload.XUpload', array(
'url' => Yii::app( )->createUrl( "/controller/upload"),
'model' => $model,
'htmlOptions' => array('id'=>'somemodel-form'),
'attribute' => 'file2',
'multiple' => true,
'formView' => 'application.views.somemodel.form2',
'uploadView' => 'application.views.somemodel.upload2',
'downloadView' => 'application.views.somemodel.download2',
'options' => array(//Additional javascript options
//This is the submit callback that will gather
//the additional data corresponding to the current file
'submit' => "js:function (e, data) {
var inputs = data.context.find(':input');
data.formData = inputs.serializeArray();
return true;
}"
),
)
);
?>
问题是当我为两个上传文件上传图片时,它适用于相同的上传模板,我尝试添加 uploadTemplate、downloadTemplate 选项但它不起作用,请告诉我如何使用 uploadTemplate、downloadTemplate 以及如何渲染为 renderPartial 以及我在哪个文件中渲染它,我应该在这一行更改 id < script id="template-upload" type="text/x-tmpl"> 和 < script id="template-download" type="text/x-tmpl"> upload.php 和 download.php 模板文件,请告诉我该怎么做?
非常感谢