plupload browse_button not showing browse dialog

半城伤御伤魂 提交于 2019-12-24 03:07:49

问题


I'm using plupload queue to upload images to our server. I am setting the value of browse_button to the id of a hyperlink, so it shows a browse dialog box. But when I click that hyperlink, nothing shows up, and the browser view just goes to the middle of the page. Below is some of the code.

(Btw, I'm using jQuery UI's dialog box to pop up the image upload div:)

<div id="dialog-form" title="Upload Images">        
    <div id="container" style="height: 200px;"></div>
    <br style="clear: both" />
    <a id="pickfiles" href="#">[Select files]</a>
</div>

<script type="text/javascript">
$(document).ready(function () {
$("#container").pluploadQueue({
       // General settings
       runtimes: 'gears,flash,silverlight,browserplus,html5',
       browse_button: 'pickfiles',
       url: '/someurl/image-upload',
       max_file_size: '10mb',
       chunk_size: '1mb',
       unique_names: true,


       // Resize images on clientside if we can
       resize: { width: 320, height: 240, quality: 90 },

       // Specify what files to browse for
       filters: [
                { title: "Image files", extensions: "jpg,gif,png,tiff,jpeg" }
                ],

                // Flash settings
                flash_swf_url: '/someurl/js/plupload.flash.swf',

            // Silverlight settings
            silverlight_xap_url: '/someurl/js/plupload.silverlight.xap'
        });

        //setup upload image dialog box
        $("#dialog-form").dialog({
            autoOpen: false,
            height: 400,
            width: 400,
            modal: true
        });
});

Can anyone tell me why this is happening instead of it opening a "browse box"? Thanks.


回答1:


The plupload queue widget won't accept your browse_button param as it's internally setting its own after it already processed the options set when instantiating the queue widget.

Given that the runtimes also use the init event to then attach what they need to work, once the browse_button is overriden on the queue widget it goes directly onto the selected runtime with that param set, and if you wanted to capture the init event if would only be after all this already happened, which is too late.

That being said, there's nothing you can do other than modifying the queue widget by yourself.



来源:https://stackoverflow.com/questions/12028499/plupload-browse-button-not-showing-browse-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!