【问题标题】:Uploadify causing error in IE 7/8Uploadify 在 IE 7/8 中导致错误
【发布时间】:2009-11-29 01:39:09
【问题描述】:

由于某种原因,当我使用 uploadify 加载页面时,在 IE 8 中我得到了这个 网页错误详情

用户代理:Mozilla/4.0(兼容;MSIE 8.0;Windows NT 6.1;Trident/4.0;SLCC2;.NET CLR 2.0.50727;.NET CLR 3.5.30729;.NET CLR 3.0.30729;Media Center PC 6.0 ) 时间戳:2009 年 11 月 29 日星期日 01:36:52 UTC

消息:对象不支持此属性或方法 线路:26 字符:86 代码:0 URI:jquery.uploadify.v2.1.0.min.js

这在 FF 和 Safari Chrome 中运行良好

我的 jquery

$("#upload").uploadify({
    uploader: '/assets/scripts/uploadify/uploadify.swf',
    script: '/post/images/uploadify',
    cancelImg: '/assets/scripts/uploadify/cancel.png',
                                buttonImg: '/assets/images/upload_button.png',
    folder: '/public/tmp',
    scriptAccess: 'always',
                                width: 175,
                                height: 46,
                                wmode: 'transparent',
    multi: false,
                                auto:true,
                                sizeLimit: '2000000',
                                buttonText: ' Upload Profile Image',
    'onError' : function (a, b, c, d) {
         if (d.status == 404)
            alert('Could not find upload script.');
         else if (d.type === "HTTP")
            alert('error '+d.type+": "+d.status);
         else if (d.type ==="File Size")
            alert(c.name+' '+d.type+' Limit: Your file size is too big, our max is 100Kb');
         else
            alert('error '+d.type+": "+d.text);
        },
    'onComplete'   : function (event, queueID, fileObj, response, data) {

        $.ajax({type: "POST",url:"/members/image_preview",data:{filearray: response},success: function(info){
            $("#target").html(info);
            },complete: crop});
    }
    //fileExt: '.jpg,.jpeg,.png,.bmp,.gif'
});

这是un Min版本中的一行:

jQuery(this).each(function(){
                    settings = jQuery.extend({
                    id             : jQuery(this).attr('id'), // The ID of the object being Uploadified
                    uploader       : 'uploadify.swf', // The path to the uploadify swf file
                    script         : 'uploadify.php', // The path to the uploadify backend upload script
                    expressInstall : null, // The path to the express install swf file
                    folder         : '', // The path to the upload folder
                    height         : 30, // The height of the flash button
                    width          : 110, // The width of the flash button
                    cancelImg      : 'cancel.png', // The path to the cancel image for the default file queue item container
                    wmode          : 'opaque', // The wmode of the flash file
                    scriptAccess   : 'sameDomain', // Set to "always" to allow script access across domains
                    fileDataName   : 'Filedata', // The name of the file collection object in the backend upload script
                    method         : 'POST', // The method for sending variables to the backend upload script
                    queueSizeLimit : 999, // The maximum size of the file queue
                    simUploadLimit : 1, // The number of simultaneous uploads allowed
                    queueID        : false, // The optional ID of the queue container
                    displayData    : 'percentage', // Set to "speed" to show the upload speed in the default queue item
                    onInit         : function() {}, // Function to run when uploadify is initialized
                    onSelect       : function() {}, // Function to run when a file is selected
                    onQueueFull    : function() {}, // Function to run when the queue reaches capacity
                    onCheck        : function() {}, // Function to run when script checks for duplicate files on the server
                    onCancel       : function() {}, // Function to run when an item is cleared from the queue
                    onError        : function() {}, // Function to run when an upload item returns an error
                    onProgress     : function() {}, // Function to run each time the upload progress is updated
                    onComplete     : function() {}, // Function to run when an upload is completed
                    onAllComplete  : function() {}  // Function to run when all uploads are completed
                }, options);

【问题讨论】:

    标签: jquery internet-explorer uploadify


    【解决方案1】:

    我遇到过这个问题。发生这种情况是因为 Uploadify 在该行使用了“设置”,并且如果您的 html 中有一个名为“设置”的 ID,则 Uploadify 会在 IE 中引发异常。似乎 FF 和 Safari 忽略了这个问题。因此,不要在包含 Uploadify 组件的页面的 html 中保留任何名为“settings”的 id,您应该会很好:)

    【讨论】:

    • 非常好的发现,这对我帮助很大。
    【解决方案2】:

    我刚刚发现,在 IE 中,如果在初始化 swf 文件时隐藏上传区域,uploadify onOpen() 事件永远不会触发,文件上传永远不会开始。因此,请确保上传曲目的 div 没有被 css 隐藏,以便稍后在 uploadify 功能启动时显示,或者在显示资产区域 div 之前不要触发该功能。

    【讨论】:

      【解决方案3】:

      您可以尝试使用未最小化的 Jquery 版本并发布有问题的行吗?这样,有人可能能够理解错误消息。

      【讨论】:

      • 是哪一行?整个东西?你能指出正确的列吗?
      • 第 31 行,我从代码中提取了从第 31 行开始的部分。有错误与这与我对它的调用不匹配有关。
      【解决方案4】:

      问题是,您的 IE 没有安装 Flash 版本。

      因此uploadify-script 不会初始化变量swfuploadify,因为变量flashInstalledfalse

      为您的浏览器安装 Flash 版本或使用 HTML5 版本

      如果您在 IE 中遇到另一个错误,例如 Object expected,那么下面的页面应该可以解决它:Link

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-08-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-04-01
        • 2011-10-01
        相关资源
        最近更新 更多