1

脚本:

$(document).ready(function () {
        $('#btnNext').click(function (e) {
            e.preventDefault();
        });
        var options = {
            beforeSend: function () {
                $("#progress").show();
                //clear everything
                $("#bar").width('0%');
                $("#message").html("");
                $("#percent").html("0%");
            },
            uploadProgress: function (event, position, total, percentComplete) {
                $("#bar").width(percentComplete + '%');
                $("#percent").html(percentComplete + '%');
            },

            success: function () {

                $("#bar").width('100%');
                $("#percent").html('100%');
            },
            complete: function (response) {
                $("#message").html("<font color='green'>" + response.responseText + "</font>");
            },
            error: function () {
                $("#message").html("<font color='red'> ERROR: unable to upload files</font>");
            }
        };
        $("#form1").ajaxForm(options);
    });

HTML:

<form id="form1" method="post" enctype="multipart/form-data">
<div>
    <input type="file" size="60" name="myfile" />
    <input type="submit" value="Ajax File Upload" />
    <div id="progress">
        <div id="bar"></div>
        <div id="percent">0%</div>
    </div>
    <br />
    <div id="message"></div>
</div>

我使用 Webform (C#) 进行了测试。有效。但是,Dotnetnuke 不工作。(回发,没有任何改变)。Dotnetnuke 有不同的方法来获取页面加载进度的百分比吗?-- 感谢阅读--

4

1 回答 1

1

Try removing the <form> tag around your module because DNN is already writing a form tag to the page surrounding the theme and modules. You can change the last line in your jquery logic to reference the form already loaded by DNN.

$("form:first").ajaxForm(options);
于 2017-04-28T14:51:32.070 回答