其实实现的思路也很简单,主要利用的是xml文件可以存放二进制数据的原理。有兴趣的朋友可以下载下面的附件研究下!!
解包文件
复制代码 代码如下:
<%@LANGUAGE="VBSCRIPT"CODEPAGE="65001"%>
<%OptionExplicit%>
<%OnErrorResumeNext%>
<%Response.Charset="UTF-8"%>
<%Server.ScriptTimeout=99999999%>
<%
DimstrLocalPath
'得到当前文件夹的物理路径
strLocalPath=Left(Request.ServerVariables("PATH_TRANSLATED"),InStrRev(Request.ServerVariables("PATH_TRANSLATED"),""))
DimobjXmlFile
DimobjNodeList
DimobjFSO
DimobjStream
Dimi,j
SetobjXmlFile=Server.CreateObject("Microsoft.XMLDOM")
objXmlFile.load(Server.MapPath("update.xml"))
IfobjXmlFile.readyState=4Then
IfobjXmlFile.parseError.errorCode=0Then
SetobjNodeList=objXmlFile.documentElement.selectNodes("//folder/path")
SetobjFSO=CreateObject("Scripting.FileSystemObject")
j=objNodeList.length-1
Fori=0Toj
IfobjFSO.FolderExists(strLocalPath&objNodeList(i).text)=FalseThen
objFSO.CreateFolder(strLocalPath&objNodeList(i).text)
EndIf
Response.Write"创建目录"&objNodeList(i).text&"
"
Response.Flush
Next
SetobjFSO=nothing
SetobjNodeList=nothing
SetobjNodeList=objXmlFile.documentElement.selectNodes("//file/path")
j=objNodeList.length-1
Fori=0Toj
SetobjStream=CreateObject("ADODB.Stream")
WithobjStream
.Type=1
.Open
.WriteobjNodeList(i).nextSibling.nodeTypedvalue
.SaveToFilestrLocalPath&objNodeList(i).text,2
Response.Write"释放文件"&objNodeList(i).text&"
"
Response.Flush
.Close
EndWith
SetobjStream=Nothing
Next
SetobjNodeList=nothing
EndIf
EndIf
SetobjXmlFile=Nothing
response.write"文件解包完毕"
%>