1

Yii の Efineuploader プラグインを使用して画像をアップロードしたいのですがuploadStoredFiles、ユーザーがプレビュー サムネイルを (ajax on 経由でonComplete) 表示した後に、画像をアップロードするメソッドを呼び出す方法がわかりません。ウィジェットから呼び出す方法があるかどうか、または外部ボタンを使用して使用できるかどうかはわかりません。

これは私のコードです:

$this->widget('ext.EFineUploader.EFineUploader',
            array(
                  'id'=>'FineUploader',
                  'config'=>array(
                                  'autoUpload'=>false,
                                  'request'=>array(
                                     'endpoint'=>$this->createAbsoluteUrl('articulo/upload'),//'/files/upload',// OR $this->createUrl('files/upload'),
                                     'params'=>array('YII_CSRF_TOKEN'=>Yii::app()->request->csrfToken),
                                                  ),
                                  'retry'=>array('enableAuto'=>true,'preventRetryResponseProperty'=>true),
                                  'chunking'=>array('enable'=>true,'partSize'=>100),//bytes
                                  'template'=>'<div class="qq-uploader span4" style="float:left;"><div class="qq-upload-button btn">Seleccionar</div><div class="qq-upload-button btn">Enviar</div><br/><br/><ul class="qq-upload-list"></ul><br/></div>',
                                  'callbacks'=>array(
                                                   'onComplete'=>"js:function(id, name, response)
                                                       {
                                                       $.post(
                                                            '".Yii::app()->baseUrl . "/articulo/mostrarImagen', 
                                                            {'nombre': response[\"filename\"]},
                                                            function(respuesta)
                                                            {
                                                                $('#imagenSubida').html(respuesta);
                                                            }
                                                        )
                                                       }",
                                                   //'onError'=>"js:function(id, name, errorReason){ }",
                                                    ),
                                  'validation'=>array(
                                            'allowedExtensions'=>array('jpg','jpeg'),
                                            'sizeLimit'=>5*1024 * 1024,//maximum file size in bytes
                                            'minSizeLimit'=>100*1024,// minimum file size in bytes
                                            ),
                                 )
                 ));

前もって感謝します

4

1 に答える 1