2013-06-28 105 views
0

我想在經典的ASP VBScript頁面上實現jQuery文件上傳,我想我可能會超出我的聯盟。 (我知道我)使用jQuery文件上傳

這就是我想實現的組件:

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(); 
      }); 
     }); 

回答

1

var url= ...東西只是爲演示網站。你可以簡單地像這樣替換它:

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

他們在他們的示例中不使用分號,他們使用逗號。這個可以嗎? – trevoray

+0

已更新的答案。 ','是對的。 – h0tw1r3

+0

最後,只需跳過下面的代碼? ? '//jquery-file-upload.appspot.com/':'server/php /' – trevoray

0

您還可以硬編碼與實際的目錄結構,並直接指向您的上傳處理程序的位置(注意正斜槓「後)。

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

上面的作品適合我。運行CentOS 6.9