【问题标题】:Using jQuery File Upload使用 jQuery 文件上传
【发布时间】:2017-06-20 23:14:47
【问题描述】:

我正在尝试在经典的 ASP VBScript 页面上实现 jQuery File Upload,但我想我可能不适合我。 (我知道我是)

这是我要实现的组件:

http://blueimp.github.io/jQuery-File-Upload/basic-plus.html

我想我已经弄清楚了它的大部分工作原理,除了如何在我的服务器上实现它。我不知道在前几行代码中输入 var url 的代码。他们似乎列出了两次主机名,之后还有另外两个位置变量,我不知道如何应用。假设我接受此表单上传的 VbSCript 页面位于:www.mysite.com/thisfolder/upload.asp 我如何将此 URL 插入这些变量?

$(function () {
'use strict';
// Change this to the location of your server-side upload handler:
var url = (window.location.hostname === 'blueimp.github.io' ||
            window.location.hostname === 'blueimp.github.io') ?
            '//jquery-file-upload.appspot.com/' : 'server/php/',
    uploadButton = $('<button/>')
        .addClass('btn')
        .prop('disabled', true)
        .text('Processing...')
        .on('click', function () {
            var $this = $(this),
                data = $this.data();
            $this
                .off('click')
                .text('Abort')
                .on('click', function () {
                    $this.remove();
                    data.abort();
                });
            data.submit().always(function () {
                $this.remove();
            });
        }); 

【问题讨论】:

    标签: jquery json asp-classic vbscript


    【解决方案1】:

    var url= ... 的东西仅用于演示站点。您可以像这样简单地替换它:

    var url = 'http://www.mysite.com/thisfolder/upload.asp',
    

    【讨论】:

    • 他们在示例中不使用分号,而是使用逗号。这样可以吗?
    • 最后,跳过下面的这段代码? ? '//jquery-file-upload.appspot.com/' : 'server/php/'
    【解决方案2】:

    您还可以使用实际的目录结构进行硬编码,并直接指向上传处理程序的位置(注意 ' 后面的正斜杠)。

    var url = window.location.hostname === '/var/www/cgi-bin/UploadHandler.php' ?

    以上对我有用。运行 CentOS 6.9

    【讨论】:

      猜你喜欢
      • 2014-08-15
      • 2014-05-04
      • 2016-01-11
      • 2013-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-13
      相关资源
      最近更新 更多