Uploadify(uploadifySettings,uploadifyUpload)在IE中不起作用

时间:2011-11-09 12:42:48

标签: javascript flash internet-explorer uploadify

任务:

Uploadify用于将文件上传到服务器。这样做是因为在上传文件类型和大小之前上传和验证时应该有一个进度条。

我使用uploadifySettings - 方法向请求添加一些其他参数。这些是其他形式的输入。 这一切都适用于FireFox。

函数调用:

this.$uploadifyInputButton.uploadifySettings(
    'scriptData', {'description': description, 'parentFolder': parentFolder}
);
//parent Folder is an ID. This has nothing to do with the folder option in uploadify

问题:

当我用IE测试时,这不起作用。

网页错误详情:

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;...)
Timestamp: Wed, 9 Nov 2011 11:49:52 UTC

Message: Object doesn't support this property or method
Line: 264
Char: 17
Code: 0

Message: Object doesn't support this property or method
Line: 264
Char: 17
Code: 0

这些消息指向uploadify解压缩库中的以下行:

returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue);

测试

当我使用Developer Tools并检查选择器document.getElementById(jQuery(this).attr('id') + 'Uploader')时,这引用了object-element(Type DispHTMLObjectElement)。那应该是对的吗?

相关

当我使用uploadifyUpload - 方法时,我收到类似的错误。


完整库功能:

    uploadifySettings:function(settingName, settingValue, resetObject) {
        var returnValue = false;
        jQuery(this).each(function() {
            if (settingName == 'scriptData' && settingValue != null) {
                if (resetObject) {
                    var scriptData = settingValue;
                } else {
                    var scriptData = jQuery.extend(jQuery(this).data('settings').scriptData, settingValue);
                }
                var scriptDataString = '';
                for (var name in scriptData) {
                    scriptDataString += '&' + name + '=' + scriptData[name];
                }
                settingValue = escape(scriptDataString.substr(1));
            }
            returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue);
        });
        if (settingValue == null) {
            if (settingName == 'scriptData') {
                var returnSplit = unescape(returnValue).split('&');
                var returnObj   = new Object();
                for (var i = 0; i < returnSplit.length; i++) {
                    var iSplit = returnSplit[i].split('=');
                    returnObj[iSplit[0]] = iSplit[1];
                }
                returnValue = returnObj;
            }
        }
        return returnValue;
    },

uploadify配置

        this.$uploadifyInputButton.uploadify({
            'auto'              : false,
            'buttonImg'         : '/img/dateiupload.gif',
            'cancelImg'         : '/scripts/uploadify/cancel.png',
            'fileDataName'      : 'file',
            'fileExt'           : '*.pdf;*.xls;*.doc;*.ppt;*.png;*.jpg',
            'height'            : 25,
            'multi'             : false,
            'queueID'           : 'uploadifyQueue',
            'queueSizeLimit'    : 1,
            'script'            : '/scripts/uploadify/uploadify.php',
            'scriptData'        : null,
            'sizeLimit'         : 10485760,
            'uploader'          : '/scripts/uploadify/uploadify.swf',
            'width'             : 122,
            'onAllComplete'     : function(event, queueID, fileObj, response, data) {
                $.colorbox.close();
            },
            'onSelect'          : function(event,ID,fileObj) {
                that.$uploadifyInputName.val(fileObj.name);
            },
            'onCancel'          : function(event,ID,fileObj,data){
                that.$uploadifyInputName.val('');
            },
            'onClearQueue'      : function(event){
                that.$uploadifyInputName.val('');
            }

          });              

0 个答案:

没有答案