query.Fileupload -ui错误异常抛出但未捕获

时间:2012-07-25 04:35:02

标签: java internet-explorer file-upload

这与我面临reference

的问题相同

它在chrome,firefox中运行良好,但在IE中却没有...错误是“IE('异常抛出而未被捕获'。第95行,Char 25')”

从引用我知道错误是在对象writer.write

java code :(它是否格式不正确):任何人都可以在此

中调试错误

writer.write("{\"name\":\"" + item.getName() + "\",\"type\":\"" + item.getContentType() + "\",\"size\":\"" + item.getSize() + "\",\"filepath\":\"" + tp2 + "\"}");

JS:

        $(function () {
        var initFileUpload = function (suffix) {

            $('#file_upload').fileUploadUI({
                namespace: 'file_upload_' + suffix,
                fileInputFilter: '#file_' + suffix,
                dropZone: $('#drop_zone_' + suffix),
                uploadTable: $('#files_' + suffix),
                downloadTable: $('.display-frame'),
                buildUploadRow: function (files, index) {
                    return $('<tr><td>' + files[index].name

                    + '<td class="file_upload_cancel">' + '<button class="ui-state-default ui-corner-all" title="Cancel">' + '<span class="ui-icon ui-icon-cancel">Cancel<\/span>' + '<\/button><\/td><\/tr>');
                },
                buildDownloadRow: function (file) {
                    //  return $('<tr><td>' + file.name +   file.filepath +'<\/td><\/tr>');     
                    var path = '<div class="picthumb" id="pic" url="' + file.filepath + '" onclick="clickpick(this)"><div class="mainpic"><img src="';
                    path += file.filepath + '" class="uploader-thumb-img" style="width: 108px; height: 120px; top: 0px; left: 0px; "/></div></div>';
                    return $(path);
                }
            });
        };
        initFileUpload(1);

    });

IE显示的错误是callback()

 if (typeof callBack === func) {
       try {
                            callBack();
           } catch (e) {
                            // Fix endless exception loop:
                            $(this).stop();
                            throw e;
                       }
           }

1 个答案:

答案 0 :(得分:0)

问题在于,出于某种原因,作者对象是item.getname是chrome中的filename.jpg 和IE:IE中的/images/filename.jpg所以我删除了不需要的item.getname

writer.write("{\",\"type\":\"" + item.getContentType() + "\",\"size\":\"" + item.getSize() + "\",\"filepath\":\"" + tp2 + "\"}");