因为flash文件无法验证csrfToken,所以如果开启了enableCsrfValidation的需要关闭当前控制器的csrfToken验证。 同时在控制的acitons中添加处理上传的upload方法
public $enableCsrfValidation = false;
public function actions()
{
return [
'upload' => 'chenyuzou\swfupload\actions\UploadAction',
];
}
暂时只支持single模式,有以下两种调用方法
$form->field($model, 'attribute')->widget('chenyuzou\swfupload\Widget',[
'url' => 'http://www.xxx.com/upload/customer/',
'path' => '@webroot/upload/customer/',
'params' => [ 'test' => '123' ]
])
use chenyuzou\swfupload\Widget;
Widget::widget([
'model'=>$model,
'attribute'=>'attribute',
'url' => 'http://www.xxx.com/upload/customer/',
'path' => '@webroot/upload/customer/',
'params' => [ 'test' => '123' ]
])
Comments