1

我在 jquery fileupload 中遇到问题,我已经包含 jqueryfileupload,为 fileupload 编写了 js,但是当我现在将文件拖放到所选区域时,它会在 chrome 中抛出类似这样的错误-

未捕获的 RangeError:超出最大调用堆栈大小。 在Mozilla中。 我的浏览器刚刚挂断。

虽然我的相同代码正在我的另一个项目中运行。谢谢

4

2 回答 2

0

我犯了同样的错误。我在 onChange 方法中注释了两行。

_onChange: function (e) {
    var that = this,
        data = {
            fileInput: $(e.target),
            form: $(e.target.form)
        };
    this._getFileInputFiles(data.fileInput).always(function (files) {
        data.files = files;
        if (that.options.replaceFileInput) {
            that._replaceFileInput(data.fileInput);
        }
        /**
        *IF I put on comment this line, this solve my problem without meeting                
          bug. I don't measure the consequence.
        **/
        //if (that._trigger('change', e, data) !== false) {
            that._onAdd(e, data);
        //}
    });
}
于 2013-09-19T12:30:23.073 回答
0

有完全相同的问题,问题是我的 jQuery-ui 版本已经过时了。这导致错误的原因是 widgetEventPrefix 丢失了,这在 jQuery-ui 的更高版本中已修复。在 _trigger 方法中,它采用事件类型并预先添加 widgetEventPrefix。由于 widgetEventPrefix 已经丢失(它应该是 fileupload),事件类型只是保持为“change”而不是它应该是什么(“fileuploadchange”)。这导致函数无限调用自身。

因此,要解决此问题,只需确保您拥有最新版本的 jQuery-ui。

链接到 jQuery ui widgetEventPrefix 错误:https ://bugs.jqueryui.com/ticket/8724

于 2016-05-11T11:48:51.727 回答