开发者

Jquery: MultiFile Plugin failing on IE7

开发者 https://www.devze.com 2022-12-22 02:53 出处:网络
I\'m using this plugin http://www.fyneworks.com/jquery/multiple-file-upload/ to create a mail attach system, but it is failing to execute on IE7.

I'm using this plugin http://www.fyneworks.com/jquery/multiple-file-upload/ to create a mail attach system, but it is failing to execute on IE7.

Here's my code:

$(".attachFile").live("click",function(){
    var id ="#"+$(this).parent().parent().attr("id");
    $(id + ' #attach').MultiFile({
        onFileAppend: function(element, value, master_element){ 
        $("#"+id + ' .attach-list').append('<li>onFileAppend - '+value+'</li>') 
        var options = { 
            url:       '/setAttach',         // override for form's 'action' attribute 
            type:      'POST'        // 'get' or 'post', override for form's 'method' attribute 
        }; 

        // bind to the form's submi开发者_高级运维t event 
        $("#"+id + ' #uploadForm').submit(function() {

           $(this).ajaxSubmit(options); 

           return false; 
        });
    }, 
    afterFileAppend: function(element, value, master_element){ 
     $("#"+id + ' #uploadForm').submit();
    }
});
});

This event is fired when user clicks hover a link to attach files. Any clues for what I'm doing wrong?

Thanks


I think it's due to a bug in jQuery 1.7: http://bugs.jquery.com/ticket/10570

The MultiFile plugin used: $("input[type=file].multi").MultiFile();

Thus cause a permission denied bug in IE7.

Possible solution would be upgrade jQuery to 1.8.


cmedeiros, I'm the developer of the plugin in question. What do you expect to happen? And what do you see instead?

I know you said it fails to execute, but at which point?


I found a solution, first create the element in the DOM, then bind MultiFile to it, and in the end append it to the screen:

var e = $("<div id=\""+id+"\" class=\"inner-center compose hidden\">"+$("#form").html()+"</div>");

$('#attach',e).MultiFile({ ... ACTIONS ... });

$(".middle-center").append(e);

Worked very well.

0

精彩评论

暂无评论...
验证码 换一张
取 消