Jquery UI对话框 - PLUPLOAD:Plupload不适用于jquery ui对话框

时间:2012-04-19 14:28:14

标签: jquery-ui plupload

尝试使用 plupload jquery ui对话框进行上传时遇到问题。

我用jqueryui构建了模态对话框,并在其中添加了一个plupload布局。

但是当我尝试使用Firefox时,它打开了我的2对话框   并且使用Safari它不起作用。

我已经看到了生成的代码,我已经看到在Firefox中我有2个

<div id="p16r5em3ep2gmrvk1ad335d1sae0_html5_container" style="position: absolute; background: none repeat scroll 0% 0% transparent; width: 0px; height: 0px; overflow: hidden; z-index: -1; opacity: 0; top: 0px; left: 0px;" class="plupload html5">
      <input type="file" multiple="multiple" accept="" style="font-size: 999px; position: absolute; width: 100%; height: 100%;" id="p16r5em3ep2gmrvk1ad335d1sae0_html5">
    </div>

第二个

<div id="p16r5em3i11ila2j0b91i163s44_html5_container" style="position: absolute; background: none repeat scroll 0% 0% transparent; width: 0px; height: 0px; overflow: hidden; z-index: -1; opacity: 0; top: 0px; left: 0px;" class="plupload html5">
        <input type="file" multiple="multiple" accept="" style="font-size: 999px; position: absolute; width: 100%; height: 100%;" id="p16r5em3i11ila2j0b91i163s44_html5">
    </div>

对于Safari,我有......

<div id="p16r5fjomdg751e101jao122t12gd0_html5_container" style="position: absolute; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; overflow-x: hidden; overflow-y: hidden; opacity: 0; top: 0px; left: 0px; width: 0px; height: 0px; z-index: -1; background-position: initial initial; background-repeat: initial initial; " class="plupload html5">
    <input id="p16r5fjomdg751e101jao122t12gd0_html5" style="font-size: 999px; position: absolute; width: 100%; height: 100%; " type="file" accept="" multiple="multiple">
</div>

第二个

<div id="p16r5fjong1g231iqm10sq1jte1nc34_html5_container" style="position: absolute; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; overflow-x: hidden; overflow-y: hidden; opacity: 0; top: 0px; left: 0px; width: 0px; height: 0px; z-index: -1; background-position: initial initial; background-repeat: initial initial; " class="plupload html5">
         <input id="p16r5fjong1g231iqm10sq1jte1nc34_html5" style="font-size: 999px; position: absolute; width: 100%; height: 100%; " type="file" accept="" multiple="multiple">
</div>

但没有什么是正确的。

注意如果我不使用模态对话框,则可以 ...

修改 我使用此代码初始化plupload

var uploader = new plupload.Uploader ({
        runtimes: 'html5,flash',
        container:'container',
        drop_element:'upDropArea',
        browse_button: 'upBrowseButton',
        url: 'url&action=action',
        flash_swf_url: '/lib/plupload/js/plupload.flash.swf',
        multipart: true,
        urlstream_upload:true,
        resize : {quality : 60},
        multiple_queues: true,

        filters : [
                   {title: 'Images', extensions: 'jpg,gif,png,jpeg'}
        ]


    });

有什么想法吗?

全部谢谢

2 个答案:

答案 0 :(得分:1)

您不必将init plupload小部件添加到jQuery UI模式对话框中,当您在脚本中的其他位置初始化它时,它可以正常工作。

答案 1 :(得分:0)

我最近通过在jQuery UI对话框的“open”函数回调中对plupload对象进行编码,在jQuery UI对话框中实现了 pluploadQueue 插件:

$("#plupload-dialog").dialog({
   autoOpen: false,
   modal: false,  // change this to true for modal, but haven't tested yet
   open: function(event, ui) {
       $("pluploader").pluploadQueue({
           runtimes: '', // add your runtimes here
           url: '',  // add your URL here
           flash_swf_url: '', // path to shockwave component
           silverlight_xap_url: '', // path to silverlight component
           max_file_size: '', // file size option
           filters: [], // filter options
           preinit: {  // preinit callbacks - note do not include separate init for pluploadQueue
               Init: function(up, info) {
               },
               UploadFile: function(up, file) {
               },
               Error: function(up, args) {
               }
           } 
       });
   }
});

不确定这是否会有所帮助,但也许值得一试。