Package the file into an XML file package, with the solution package ASP Tools!
The website source code all package into the XML file inside, generate Updata.xml file, upload the XML file to the space inside
Then release all the files through the install.asp file.
It is the same function as Z-blog's automatic installation package, hehe.
Code is outdated a brother wrote, but the code seems to have errors, this is my reference to his changes have been, you can run the normal! ~~
This code can be applied to an ASP program's automatic upgrade service. Concrete how to achieve, welcome to explore! ~~
In the following replies to discuss! ~~~
Instead of setting the package Catalog Edition, you need to set the difference between the two versions of the packaged catalog:
Instead of setting up a packaged catalog, just put it in the directory you want to package.
You need to set the packaged directory version, you must specify the path to be packaged (modified in the program), not specified, can not be packaged.
Do not set directory-packaging files
Copy Code code as follows:
<% @LANGUAGE = "VBSCRIPT" codepage= "65001"%>
<% Option Explicit%>
<% on Error Resume Next%>
<% response.charset= "UTF-8"%>
<% server.scripttimeout=99999999%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> File Packaging Program </title>
</head>
<body>
<%
Dim Zippathdir,zippathfile,zipfileext
Dim Startime,endtime
' Change the path of the folder you want to package here
Zippathdir = Left (Request.ServerVariables ("path_translated"), InStrRev (Request.ServerVariables ("PATH_TRANSLATED") ,"\"))'
' Generated XML file
Zippathfile = "Update.xml"
' No packaged file name extension
Zipfileext = "Db;bak"
If Right (zippathdir,1) <> "\" then zippathdir=zippathdir& "\"
' Start packing
Createxml (Zippathfile)
' Traverse all files and folders within the directory
Sub LoadData (Dirpath)
Dim xmldoc
Dim fso ' FSO Object
Dim objfolder ' Folder Object
Dim objsubfolders ' Subfolder Collection
Dim Objsubfolder ' Subfolder Object
Dim objfiles ' File Collection
Dim objfile ' File Object
Dim objstream
Dim Pathname,textstream,pp,xfolder,xfpath,xfile,xpath,xstream
Dim pathnamestr
Response. Write ("==========" &DirPath& "==========<br>")
Set Fso=server. CreateObject ("Scripting.FileSystemObject")
Set OBJFOLDER=FSO. GetFolder (dirpath) ' Create Folder object
Response.Write Dirpath
Response.Flush
Set xmldoc = Server.CreateObject ("Microsoft.XMLDOM")
Xmldoc.load (Server.MapPath (zippathfile))
Xmldoc.async=false
' Write each folder path
Set xfolder = Xmldoc.selectsinglenode ("//root"). AppendChild (xmldoc.createelement ("folder"))
Set Xfpath = Xfolder.appendchild (xmldoc.createelement ("path"))
Xfpath.text = replace (Dirpath,zippathdir, "")
Set Objfiles=objfolder.files
For each objfile in Objfiles
If LCase (Dirpath & Objfile.name) <> LCase (Request.ServerVariables ("path_translated")) and LCase (Dirpath & Objfile.name) <> LCase (Dirpath & Zippathfile) Then
If ext (objfile.name) Then
Response.Write "---<br/>"
Pathnamestr = Dirpath & "" & Objfile.name
Response.Write Pathnamestr & ""
Response.Flush
'================================================
' Write path to file and contents of file
Set xfile = Xmldoc.selectsinglenode ("//root"). AppendChild (xmldoc.createelement ("file"))
Set Xpath = Xfile.appendchild (xmldoc.createelement ("path"))
Xpath.text = replace (Pathnamestr,zippathdir, "")
' Create a file stream to read the contents of the file and write to the XML file
Set objstream = Server.CreateObject ("ADODB. Stream ")
objStream.Type = 1
objStream.Open ()
objStream.LoadFromFile (PATHNAMESTR)
objstream.position = 0
Set XStream = Xfile.appendchild (xmldoc.createelement ("stream"))
Xstream.setattribute "Xmlns:dt", "Urn:schemas-microsoft-com:datatypes"
' File contents are stored in two ways
Xstream.datatype = "Bin.base64"
Xstream.nodetypedvalue = Objstream.read ()
Set objstream=nothing
Set Xpath = Nothing
Set XStream = Nothing
Set xfile = Nothing
'================================================
End If
End If
Next
Response.Write "<p>"
Xmldoc.save (Server.MapPath (zippathfile))
Set Xfpath = Nothing
Set Xfolder = Nothing
Set xmldoc = Nothing
' Subfolder object created by
Set Objsubfolders=objfolder.subfolders
' Calls recursive traversal of subfolders
For each objsubfolder in Objsubfolders
Pathname = Dirpath & objsubfolder.name & "\"
LoadData (Pathname)
Next
Set objfolder=nothing
Set objsubfolders=nothing
Set fso=nothing
End Sub
' Create an empty XML file to prepare for writing to the file
Sub Createxml (FilePath)
' Program Start execution time
Startime=timer ()
Dim xmldoc,root
Set xmldoc = Server.CreateObject ("Microsoft.XMLDOM")
Xmldoc.async = False
Set Root = xmldoc.createprocessinginstruction ("xml", "version= ' 1.0 ' encoding= ' UTF-8 '")
Xmldoc.appendchild (Root)
Xmldoc.appendchild (xmldoc.createelement ("root"))
Xmldoc.save (Server.MapPath (FilePath))
Set Root = Nothing
Set xmldoc = Nothing
LoadData (Zippathdir)
' Program End time
Endtime=timer ()
Response. Write ("Page Execution Time:" & FormatNumber ((Endtime-startime), 3) & "SEC")
End Sub
' Determine if the file type is legitimate
function ext (filename)
Ext = True
Dim temp_ext,e
Temp_ext = Split (Zipfileext, ";")
For E=0 to UBound (Temp_ext)
If mid (filename, ".") Filename,instrrev +1) =temp_ext (e) then Ext=false
Next
End Function
%>
</body>
</html>
Extract ASP Files
Copy Code code as follows:
<% @LANGUAGE = "VBSCRIPT" codepage= "65001"%>
<% Option Explicit%>
<% on Error Resume Next%>
<% response.charset= "UTF-8"%>
<% server.scripttimeout=99999999%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> File Unpack Program </title>
</head>
<body>
<%
Dim Strlocalpath
' Get the physical path to the current folder
Strlocalpath=left (Request.ServerVariables ("path_translated"), InStrRev (Request.ServerVariables ("PATH_TRANSLATED "),"\"))
Dim Objxmlfile
Dim objNodeList
Dim objFSO
Dim objstream
Dim I,j
Set objxmlfile = Server.CreateObject ("Microsoft.XMLDOM")
Objxmlfile.load (Server.MapPath ("Update.xml"))
If objxmlfile.readystate=4 Then
If objXmlFile.parseError.errorCode = 0 Then
Set objnodelist = objXmlFile.documentElement.selectNodes ("//folder/path")
Set objFSO = CreateObject ("Scripting.FileSystemObject")
J=objnodelist.length-1
For I=0 to J
If objfso.folderexists (Strlocalpath & objNodeList (i). Text) =false Then
Objfso.createfolder (Strlocalpath & objNodeList (i). Text)
End If
Response.Write "Create Directory" & objNodeList (i). Text & "<br/>"
Response.Flush
Next
Set objFSO = Nothing
Set objnodelist = Nothing
Set objnodelist = objXmlFile.documentElement.selectNodes ("//file/path")
J=objnodelist.length-1
For I=0 to J
Set objstream = CreateObject ("ADODB. Stream ")
With Objstream
. Type = 1
. Open
. Write objnodelist (i) nextsibling.nodetypedvalue
. SaveToFile Strlocalpath & objNodeList (i) text,2
Response.Write "Release File" & objNodeList (i). Text & "<br/>"
Response.Flush
. Close
End With
Set objstream = Nothing
Next
Set objnodelist = Nothing
End If
End If
Set Objxmlfile = Nothing
Response.Write "File Unpack complete"
%>
</body>
</html>
Package file Download