Plupload 文件浏览器打不开

发布于 2024-11-03 18:20:42 字数 2177 浏览 0 评论 0原文

我正在尝试将 plupload 与 mvc2 一起使用,但 filebrowser-window 未打开。

我的代码:

 <script type="text/javascript">

// Convert divs to queue widgets when the DOM is ready
$(function () {
    $("#uploader").pluploadQueue({
        // General settings
        runtimes: 'gears,flash,silverlight,browserplus,html5',
        url: '<%: Url.Content( "~//Uploades/Horses/" ) %>',
        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" },
        { title: "Zip files", extensions: "zip" }
    ],

        // Flash settings
        flash_swf_url: '../../../../Scripts/plupload/plupload.flash.swf',

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

    // Client side form validation
    $('form').submit(function (e) {
        var uploader = $('#uploader').pluploadQueue();
        uploader.refresh();
        // Validate number of uploaded files
        if (uploader.total.uploaded == 0) {
            // Files in queue upload them first
            if (uploader.files.length > 0) {
                // When all files are uploaded submit form
                uploader.bind('UploadProgress', function () {
                    if (uploader.total.uploaded == uploader.files.length)
                        $('form').submit();
                });

                uploader.start();
            } else
                alert('You must at least upload one file.');

            e.preventDefault();
        }
    });
});

<div id="uploader" style="height:300px">
        <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
    </div>

如果我尝试调试 uploadingelemt,则显示没有任何问题。但是,如果我单击“添加文件”,窗口只会跳转到页面顶部,并且不会发生其他情况。

Firebug 没有显示任何问题。

我在《FF4》和《FF4》中都尝试过。使用 flash 和 silverlight 的 IE 8

有人有想法吗? 非常感谢您并祝您周末愉快!

I'm trying to use plupload with mvc2 but the filebrowser-window does not open.

my code:

 <script type="text/javascript">

// Convert divs to queue widgets when the DOM is ready
$(function () {
    $("#uploader").pluploadQueue({
        // General settings
        runtimes: 'gears,flash,silverlight,browserplus,html5',
        url: '<%: Url.Content( "~//Uploades/Horses/" ) %>',
        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" },
        { title: "Zip files", extensions: "zip" }
    ],

        // Flash settings
        flash_swf_url: '../../../../Scripts/plupload/plupload.flash.swf',

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

    // Client side form validation
    $('form').submit(function (e) {
        var uploader = $('#uploader').pluploadQueue();
        uploader.refresh();
        // Validate number of uploaded files
        if (uploader.total.uploaded == 0) {
            // Files in queue upload them first
            if (uploader.files.length > 0) {
                // When all files are uploaded submit form
                uploader.bind('UploadProgress', function () {
                    if (uploader.total.uploaded == uploader.files.length)
                        $('form').submit();
                });

                uploader.start();
            } else
                alert('You must at least upload one file.');

            e.preventDefault();
        }
    });
});

<div id="uploader" style="height:300px">
        <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
    </div>

If I try to debug the uploadingelemt is showen with out any problems. But If I click add files the window just jumps to the top of my page and nothin else happens.

Firebug does not show any problems.

I've tried in FF4 & IE 8 using flash and silverlight

Any one an idea?
Thank you very much and wish you a nice weekend!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

擦肩而过的背影 2024-11-10 18:20:42

您的浏览器将使用 Flash 运行时,因为它列在“html5”之前。 Flash 运行时需要设置“容器:“my_uploader_container_id””

并且您的“pickfiles”按钮需要放置到 ID 为“my_uploader_container_id”的 DIV 中。

另一个解决方案是使用 html5 引擎 - 在“运行时”参数中将其列在 flash 之前。但 html5 运行时在 IE 中不起作用。

Your browser will use Flash runtime as it is listed before the 'html5'. Flash runtime requires setting of 'container: "my_uploader_container_id"'

And your 'pickfiles' button need to be placed into the DIV with ID 'my_uploader_container_id'.

Another solution is using html5 engine - list it before flash in 'runtimes' parameter. But html5 runtime does not work in IE.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文