如何为 DotNetNuke 使用 Aquantum 多文件上传器(Jquery 插件)?

发布于 2024-10-29 04:30:57 字数 2548 浏览 0 评论 0原文

我正在尝试在 DotNetNuke 中使用 Aquantum 多个文件上传,但我无法让它工作。显然是因为我无法设置表单标签。

有谁知道如何在不使用 form 标签的情况下实现 pling ?

例如: 示例显示以下内容:

    <form id="file_upload" class="file_upload" runat="server">
      <div id = "filediv">
        <input type="file" name="file" multiple>
        <button>Upload</button>
        <div>Upload files</div>
      </div>
      <table id="files"></table> ...
    </form>

但我希望能够执行以下操作:

    <div id="file_upload" class="file_upload" runat="server">
      <div id = "filediv">
        <input type="file" name="file" multiple>
        <button>Upload</button>
        <div>Upload files</div>
      </div>
      <table id="files"></table> ...
    </div>

我正在使用的 Javascript 是这个:

  <script>
        /*global $ */
        $(function() {


            $('.file_upload').fileUploadUI({
                url: 'FileUpload.ashx',
                method: 'POST',
                uploadTable: $('#files'),
                downloadTable: $('#files'),
                buildUploadRow: function (files, index) {
                    return $('<tr><td>' + files[index].name + '<\/td>' +
                        '<td class="file_upload_progress"><div><\/div><\/td>' +
                        '<\/td><\/tr>');
                },
                buildDownloadRow: function(file) {
                return $('<tr id="file_'+file.name+'"><td>' + file.name + '<\/td>'
                    + '<td class="file_uploaded">' +
                    '<span class="ui-icon ui-icon-check"><\/span>' +
                    '<\/td><\/tr>');

                }, beforeSend: function(event, files, index, xhr, handler, callBack) {
                    if (files[index].size > 500000) {
                        handler.uploadRow.find('.file_upload_progress').html('<span class="ui-icon ui-icon-alert"><\/span>FILE TOO BIG!');
                        setTimeout(function() {
                            handler.removeNode(handler.uploadRow);
                        }, 10000);
                        return;
                    }
                    callBack();
                }
            });
        });
    </script> 

谢谢!欢迎任何帮助!

I'm trying to use Aquantum Multiple File Upload in DotNetNuke, but I cannot get it working. Aparently is because I cannot set the form tag.

Does anybody know how to implement the pluing without using the form tag?

Eg: Samples shows the following:

    <form id="file_upload" class="file_upload" runat="server">
      <div id = "filediv">
        <input type="file" name="file" multiple>
        <button>Upload</button>
        <div>Upload files</div>
      </div>
      <table id="files"></table> ...
    </form>

But I would like to be able to do the following:

    <div id="file_upload" class="file_upload" runat="server">
      <div id = "filediv">
        <input type="file" name="file" multiple>
        <button>Upload</button>
        <div>Upload files</div>
      </div>
      <table id="files"></table> ...
    </div>

The Javascript I'm using is this one:

  <script>
        /*global $ */
        $(function() {


            $('.file_upload').fileUploadUI({
                url: 'FileUpload.ashx',
                method: 'POST',
                uploadTable: $('#files'),
                downloadTable: $('#files'),
                buildUploadRow: function (files, index) {
                    return $('<tr><td>' + files[index].name + '<\/td>' +
                        '<td class="file_upload_progress"><div><\/div><\/td>' +
                        '<\/td><\/tr>');
                },
                buildDownloadRow: function(file) {
                return $('<tr id="file_'+file.name+'"><td>' + file.name + '<\/td>'
                    + '<td class="file_uploaded">' +
                    '<span class="ui-icon ui-icon-check"><\/span>' +
                    '<\/td><\/tr>');

                }, beforeSend: function(event, files, index, xhr, handler, callBack) {
                    if (files[index].size > 500000) {
                        handler.uploadRow.find('.file_upload_progress').html('<span class="ui-icon ui-icon-alert"><\/span>FILE TOO BIG!');
                        setTimeout(function() {
                            handler.removeNode(handler.uploadRow);
                        }, 10000);
                        return;
                    }
                    callBack();
                }
            });
        });
    </script> 

Thanks! Any help will be welcomed!

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

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

发布评论

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

评论(1

云醉月微眠 2024-11-05 04:30:57

查看文档,看起来需要使用 form 来支持 IE & 浏览器。 Opera,但 DNN 中唯一可用的表单是主要的 WebForms 表单。您可能需要考虑将 FileUpload.ashx 行为移动到 web.config 中设置的 HttpHandler 中。然后,您可以在 DNN 之前处理请求(使用 jQuery 插件上的 formData 选项向帖子添加某种标志,然后在处理程序中查找该标志)。

查看您的代码,它似乎应该适用于其他浏览器。 文档中的第一个常见问题解答表示您只需要设置 urlmethodfieldName 选项来解决支持它的浏览器的表单(因此您可以尝试设置 fieldName 看看是否有帮助)。

您看到什么问题?有 JavaScript 错误吗?您的 ASHX 处理程序是否被击中?

Looking at the documentation, it looks like you need to use a form to support IE & Opera, but the only form available in DNN is the main WebForms one. You might want to consider moving your FileUpload.ashx behavior into an HttpHandler that is setup in the web.config. Then you can process the request before DNN does (add some sort of flag to the post using the formData option on the jQuery plugin, then look for that in your handler).

Looking at your code, it appears that it should work for the other browsers. The first FAQ in the documentation says that you just need to set url, method, and fieldName options to work around the form for browsers that support it (so you might try setting fieldName and seeing if that helps).

What problem are you seeing? Any JavaScript errors? Is your ASHX handler being hit at all?

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