首先在伺服器端先建立乙個程式可以生成xml檔案,以返回客戶端,(getfolder.asp)
'written by linzhang chen ,2003-4-20
response.write "<?xml version=""1.0"" encoding=""gb2312""?>"&chr(13)
response.write ""&chr(13)
folders=request("folder")
if folders="/" then
folders=""
end if
dim count
count=0
folders=replace(folders,"..","")
basefolder="../media/"'基準的資料夾路徑
newfolder=basefolder&folders
set fso =server.createobject("scripting.filesystemobject")
set sf=f.subfolders
for each fd in sf'返回指定路徑下面的資料夾列表
response.write ""&chr(13)
response.write "folder"&chr(13)
response.write ""&fd.name&""&chr(13)
response.write ""&chr(13)
count=count+1
next
set sf=nothing
set ff=f.files
for each fi in ff
fname=fi.name
if instr("asf,wma,wmv",lcase(mid(fname,instrrev(fname,".")+1)))>0 then'設定允許返回的檔案型別,防止原始碼洩露
response.write ""&chr(13)
response.write "file"&chr(13)
response.write ""&fname&""&chr(13)
response.write ""&chr(13)
count=count+1
end if
next
'如果該目錄下沒有檔案,就發乙個空元素
if count=0 then
response.write ""&chr(13)
response.write "empty"&chr(13)
response.write "0"&chr(13)
response.write ""&chr(13)
end if
response.write ""
set ff=nothing
set f=nothing
set fso=nothing
%>
下面就是客戶端的js的功夫了(selectfile.asp)
查詢範圍(i):
檔案型別(t):
流**檔案(*.asf,*.wmv,*.wma)
裡面還有乙個小檔案blank.htm用來定義檔案和資料夾顯示的樣式
呼叫的時候用以下函式,就可以實現以假亂真的伺服器端選擇檔案的效果
function selectfile()
}該函式最後返回的是選中的檔名,函式裡面所使用的幾張大家就自已從檔案選擇框上抓了:)
24 實現http伺服器端
1.http hypertext transfer protocol超文字傳輸協議。超文字是可以根據客戶端請求而跳轉的結構化資訊。http協議是以超文字傳輸為目的而設計的應用層協議,是基於tcp ip實現的協議,實現該協議就相當於實現了web伺服器端。2.http協議又稱為無狀態的stateless...
socket伺服器端
伺服器 include winsock2.h include string.h include stdio.h include time.h include stdarg.h include stdlib.h pragma comment lib,ws2 32 void errexit const ...
kerberos伺服器端
1.安裝tcl wget tar zvxf tcl8.5.12 src.tar.gz cd tcl8.5.12 cd unix configure make make install 3.解壓 tar xvf krb5 1.10.3 signed.tar tar zvxf krb5 1.10.3.t...