多个文件上传冻结在chrome中

时间:2012-07-25 19:51:19

标签: html5 google-chrome uploading

我正在使用我在我的网站上实现的uploadifive(html5)jquery插件。一旦我添加文件就开始上传 - 在firefox中,但是当我在开始上传之前添加文件时,chrome会冻结2-4秒我上传的文件大小约为4-10 MB /文件。 我能做些什么来防止这种情况发生? 任何帮助或建议将不胜感激。

代码:

$('#music_upload').uploadifive({
                                    'auto' :true,
                                    'queueID':'uploadqueue',
                                    'simUploadLimit': 1,
                                    'multi': true,
                                    'queueSizeLimit' : 50,
                                    'dnd': true,
                                    'width': 80,
                                    'height' : 23,
                                    'fileSizeLimit' : 20000,
                                    'buttonText' : 'Upload files',
                                    'formData'      : {'user' : $.cookie("username"),'key' : currentsession},
                                    'uploadScript' : '<?php echo site_url('home/upload_music_handler'); ?>',
                                    'removeCompleted' : false,
                                    'onCancel'     : function(file) {
                                       // remove song from database
                                       var username = $.cookie('username');
                                       //check if song extension
                                       if(checkFileExtension(file.name) == 'audio'){
                                            //remove file and remove from db
                                           $.post('<?php echo site_url('home/removesong'); ?>',
                                                    {ajax : 1, username : username, song_title : file.name},
                                                    function(data) {

                                                    },"json");

                                        }
                                        if(checkFileExtension(file.name) == 'image'){
                                            //else remove from album cover art
                                            $.post('<?php echo site_url('home/removealbumcover'); ?>',
                                                    {ajax : 1, username : username, song_title : file.name},
                                                    function(data) {

                                                    },"json");
                                            //remove from display


                                        }


                                       //remove file

                                       //remove li from song settings or album cover.
                                    },
                                    'onQueueComplete' : function(uploads) {

                                        $(".album-settings-section").show();

                                       //add sortable for queue-items
                                       $( "#uploadqueue").sortable({
                                            revert: true

                                        });
                                        $( ".uploadifive-queue-item" ).draggable({
                                            connectToSortable: "#uploadqueue",
                                            containment: "#uploadqueue",
                                            handle: ".song_drag",
                                            revert: "invalid"
                                        });

                                    },
                                    'onUploadComplete' : function(file, data) {

                                        $(file.queueItem).find('.songname').text(data);
                                        $( ".songname" ).disableSelection();
                                        $('.songname').bind('dblclick',
                                        function(e){
                                            e.preventDefault();
                                            $(this).attr('contentEditable',true);
                                        });
                                        //get and set the songname
                                        $(".public_or_private_album li a,.download_or_stream_album li a,.download_or_stream li a").click(function(e){
                                            e.preventDefault();
                                            $(this).parent().parent().find('.active').removeClass('active')
                                            $(this).parent().addClass('active');
                                        })
                                    }

                                }); //end of upload

上传音乐处理程序请求仅在我选择文件后2-4秒发送。

enter image description here

0 个答案:

没有答案