在IE 7/8中导致上传导致错误

时间:2009-11-29 01:39:09

标签: jquery internet-explorer uploadify

由于某种原因,当我使用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'
});

这是联合国版本的行:

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);

4 个答案:

答案 0 :(得分:4)

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

答案 1 :(得分:1)

我刚发现的一点是,在IE中,如果在初始化swf文件时隐藏了上传区域,则uploadify onOpen()事件永远不会触发,文件上传永远不会启动。因此,请确保上传曲目的div不是用css隐藏的,以便稍后在uploadify函数启动时显示,或者在显示资源区div之前不启动该函数。

答案 2 :(得分:0)

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

答案 3 :(得分:0)

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

因为变量swfuploadifyflashInstalled,所以uploadify脚本不会传播变量false

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

如果您在IE中有另一个错误,例如Object expected,那么下一页应解决它:Link