2013-10-21 177 views
3

我覺得jQuery-File-Upload插件界面很棒,功能齊全!我非常喜歡它!但我的服務器是傳統的ASP iis ...現在我想使用jQuery文件上傳來上傳文件(圖像文件)。請幫助我thx!jQuery-File-Upload Classic-ASP

我的服務器上我有3個文件和上傳工作正常!現在我想添加像index.asp這樣的html5文件。並使用jQuery-File-Upload基本加我們。我需要進度條,驗證,預覽圖像和客戶端圖像大小調整。也許太複雜了。

也許我們只需編輯 「jQuery的文件上傳/ index.html的」

<form id="fileupload" action="http://myserver.com/html5/upload.asp" method="POST" enctype="multipart/form-data"> 

我希望有人指導我。

請幫我thx!和對不起我的英語...

3個文件/html5/index.asp

<!DOCTYPE html> 
    <html> 
    <head> 
    <meta charset="gbk" /> 
    <title>fileReader對象的事件先後順序</title> 
    </head> 
    <body> 
    單文件上傳<br /> 
    <form action="upload.asp" method="post" enctype="multipart/form-data"> 
    <p> 
表單:<input type="text" name="form1" value="form1_text" /><br /> 
     文件:<input type="file" id="file" name="file1" multiple /> 
<input type="submit" value="上傳" /> 
     </p> 
     <div name="result" id="result"> 
     </div> 
    </form> 
    </body></html> 

2 /html5/index.asp

<!--#include file="UpLoad_Class.asp"--> 
<% 
dim upload 
set upload = new AnUpLoad 
upload.Exe = "*" 
upload.MaxSize = 2 * 1024 * 1024 '2M 
upload.GetData() 
if upload.ErrorID>0 then 
response.Write upload.Description 
else 
dim file,savpath 
savepath = "upload" 
for each frm in upload.forms("-1") 
    response.Write frm & "=" & upload.forms(frm) & "<br />" 
next 

set file = upload.Files("file1") 
if file.isfile then 
    result = file.saveToFile(savepath,0,true) 
    if result then 
     response.Write "文件'" & file.LocalName & "'上傳成功,保存位置'" & server.MapPath(savepath & "/" & file.filename) & "',文件大小" & file.size & "字節<br />" 
    else 
     response.Write file.Exception & "<br />" 
    end if 
end if 

set file = upload.Files_Muti("file1",1) 
if file.isfile then 
    result = file.saveToFile(savepath,1,true) 
    if result then 
     response.Write "文件'" & file.LocalName & "'上傳成功,保存位置'" & server.MapPath(savepath & "/" & file.filename) & "',文件大小" & file.size & "字節<br />" 
    else 
     response.Write file.Exception & "<br />" 
    end if 
end if 

Response.Write "成功保存的文件個數:" & Upload.QuickSave("file1",savepath) & "個" 
end if 
set upload = nothing 
%> 

和3 /html5/UpLoad_Class.asp它`太過分了代碼

<% 
Dim StreamT 
Class AnUpLoad 
Private Form, Fils 
Private vCharSet, vMaxSize, vSingleSize, vErr, vVersion, vTotalSize, vExe, vErrExe,vboundary, vLostTime, vMode, vFileCount,StreamOpened 
private vMuti,vServerVersion 
Public Property Let Mode(ByVal value) 
    vMode = value 
End Property 

Public Property Let MaxSize(ByVal value) 
    vMaxSize = value 
End Property 

Public Property Let SingleSize(ByVal value) 
    vSingleSize = value 
End Property 

Public Property Let Exe(ByVal value) 
    vExe = LCase(value) 
    vExe = replace(vExe,"*.","") 
    vExe = replace(vExe,";","|") 
End Property 

Public Property Let CharSet(ByVal value) 
    vCharSet = value 
End Property 

Public Property Get ErrorID() 
    ErrorID = vErr 
End Property 

Public Property Get FileCount() 
    FileCount = Fils.count 
End Property 

Public Property Get Description() 
    Description = GetErr(vErr) 
End Property 

Public Property Get Version() 
    Version = vVersion 
End Property 

Public Property Get TotalSize() 
    TotalSize = vTotalSize 
End Property 

Public Property Get LostTime() 
    LostTime = vLostTime 
End Property 
...................................ect ...i think you guys knows 
+1

我剛剛從jQuery-File-Upload頁面下載了zip文件。它沒有提供與php相同的asp處理程序腳本,因此您可能需要從zip文件中取出並在經典ASP中重寫它們的php文件。有一些asp腳本具有你所要求的一些功能,看看這個 - http://www.uploadify.quickersite.com/。或者,你的IIS服務器應該支持PHP,甚至可能已經安裝了它,所以也許你可以直接使用php處理程序腳本。 – John

+0

謝謝約翰!我的服務器只支持asp classic ....所以我可能需要將php轉換爲asp ...但它對我來說很難。 -_- !! – hakaman

+0

不幸的是,除非您準備好深入服務器的毛茸茸的內部,否則將任何現有代碼翻譯成經典的ASP將牢牢落入Not Easy(TM)領域。您需要尋找一個上傳實用程序,該實用程序旨在與經典ASP一起使用。 (我現在唯一知道的就是Persits的AspUpload。) – Martha

回答

5

我有點困惑與jQuery的文件上傳自己,但審查插件文件後,我發現什麼是需要的插件在Classic ASP環境中工作。

  1. 你必須有一個上傳組件,其中未設置在裸IIS設置(您可以使用從Persits的AspUpload如果它是可用的服務器上,或FreeAspUpload這是一個免費的DLL成分等都可能是在任何經典ASP服務器上使用)。

  2. 您必須設置您的上傳腳本編寫上傳的文件,並返回一個有效的JSON響應的插件,該插件的文檔上的定義是:https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#using-jquery-file-upload-ui-version-with-a-custom-server-side-upload-handler

我設置的上傳腳本後JSON響應,插件正常工作。

祝你好運!

Ferdi

相關問題