1

我正在使用 XUpload Extension 将多重上传到我的站点基础 yii 框架。它工作得很好。直到我尝试重命名上传文件夹,xupload 上传失败!我可以预测这种情况。但是当上传成功或未能在我的网站上显示通知时,我不知道如何创建回调:

这是官方 Xupload 扩展页面

这是我的代码:

$this->widget(
    $className  = 'ext.xupload.XUploadWidget',
    $properties = array(
        'url' => "http://localhost/Upload/multiupload.php"),

        ...//another config here

        'options' => array(
            'beforeSend' => 'js:function(event, files, index, xhr, handler, callBack) {
                handler.uploadRow.find(".upload_start button").click(callBack);
            }',

            //Callback function when upload complete
            'onComplete'=>'js:function(event, files, index, xhr, handler, callBack) {
                if(xhr.status==200) {
                    alert("Ok");
                } else {
                    alert("Error"+ xhr.status);
                }
            }',
        ),
    )
);

上传成功时可以看到onComplete事件正在运行,但上传失败时不会。如何处理上传失败事件?

4

1 回答 1

1

备查:

jquery.fileupload.js 文件中有类似“失败”的内容。

        // Callback for failed (abort or error) uploads:
        // fail: function (e, data) {}, // .bind('fileuploadfail', func);
于 2013-09-03T21:54:14.220 回答