一、asp程序打包上传
1、打包生成.site文件
自己下载pack_site.rar
里面有两个文件,
rar.exe是本机打包用的
rar.asp是服务器段解压用的.
简单步骤:
如果你iis启动了,请先关闭
运行rar.exe(在你的桌面右下角有个红的b字 说明运行好了)-->打开ie-->输入http://127.0.0.1/
然后把你的要上传的网站复制到 rar.exe所在目录下的www目录
打包网站(http://127.0.0.1/)-->输入压缩包文件名-->提交
上传 rar.asp + xxx.site 两个文件
http://你的域名/rar.asp ---->恢复数据--->选择xxx.site-->提交.
2、打包生成.mdb文件
下载asppack.rar,源码如下。。
解压后为一个asp文件,运行后,输入要打包的绝对目录,点击P。弹出OK对话框后,自己下载下载,再在本地运行这个文件,输入路径后解包(或用下面的工具也可以,不过打包文件要和这个工具放在同一个目录)。
提供和这个一样的本地打包器pack_mdb.rar
<%@LANGUAGE="VBscrīpt" CODEPAGE="936"%>
<object runat="server" id="fso" scope="page" classid="clsid:0D43FE01-F093-11CF-8940-00A0C9054228"></object>
<%
Option Explicit
'ASP Separation software bundles
dim fsoX
Const isDebugMode = False ''Does debugging mode
Sub createIt(fsoX)
If isDebugMode = False Then
On Error Resume Next
End If
Set fsoX = Server.CreateObject("scrīpting.FileSystemObject")
If IsEmpty(fsoX) Then
Set fsoX = fso
End If
If Err Then
Err.Clear
End If
End Sub
Sub chkErr(Err)
If Err Then
echo "<style>body{margin:8;border:none;overflow:hidden;background-color:buttonface;}</style>"
echo "<br/><font size=2><li>error: " & Err.Descrīption & "</li><li>error: " & Err.Source & "</li><br/>"
echo "<hr>Powered By badwolf</font>"
Err.Clear
Response.End
End If
End Sub
Sub echo(str)
Response.Write(str)
End Sub
Function HtmlEncode(str)
If isNull(str) Then
Exit Function
End If
HtmlEncode = Server.HTMLEncode(str)
End Function
Sub alertThenClose(strInfo)
Response.Write "<scrīpt>alert(""" & strInfo & """);window.close();</scrīpt>"
End Sub
Sub showErr(str)
Dim i, arrayStr
str = Server.HtmlEncode(str)
arrayStr = Split(str, "$$")
' Response.Clear
echo "<font size=2>"
echo "error:<br/><br/>"
For i = 0 To UBound(arrayStr)
echo " " & (i + 1) & ". " & arrayStr(i) & "<br/>"
Next
echo "</font>"
Response.End
End Sub
Call createIt(fsoX)
Call PageAddToMdb()
Set fsoX = Nothing
Sub PageAddToMdb()
Dim theAct, thePath
theAct = Request("theAct")
thePath = Request("thePath")
Server.scrīptTimeOut = 5000
If theAct = "addToMdb" Then
addToMdb(thePath)
alertThenClose("ok!")
Response.End
End If
If theAct = "releaseFromMdb" Then
unPack(thePath)
alertThenClose("ok!")
Response.End
End If
echo "<html>"& vbNewLine
echo "<head>"& vbNewLine
echo "<title>Packing folders / untied device</title>"& vbNewLine
echo "<style>"& vbNewLine
echo "A:visited {color: #ffffff;text-decoration: none;}"& vbNewLine
echo "A:active {color: #ffffff;text-decoration: none;}"& vbNewLine
echo "A:link {color: #ffffff;text-decoration: none;}"& vbNewLine
echo "A:hover {color: #ffffff;text-decoration: none;}"& vbNewLine
echo "BODY {font-size: 9pt;COLOR: #ffffff;font-family: ""Courier New"";border: none;background-color: #000000;}"& vbNewLine
echo "textarea {font-family: ""Courier New"";font-size: 12px;border-width: 1px;color: #000000;}"& vbNewLine
echo "table {font-size: 9pt;}"& vbNewLine
echo "form {margin: 0;}"& vbNewLine
echo "#fsoDriveList span{width: 100px;}"& vbNewLine
echo "#FileList span{width: 90;height: 70;cursor: hand;text-align: center;word-break: break-all;border: 1px solid buttonface;}"& vbNewLine
echo ".anotherSpan{color: #ffffff;width: 90;height: 70;text-align: center;background-color: #0A246A;border: 1px solid #0A246A;}"& vbNewLine
echo ".font{font-size: 35px;line-height: 40px;}"& vbNewLine
echo "#fileExplorerTools {background-color: buttonFace;}"& vbNewLine
echo ".input, input {border-width: 1px;}"& vbNewLine
echo "</style>" & vbNewLine
echo "</head>"& vbNewLine
echo "<body>"& vbNewLine
echo "P:<br/>"& vbNewLine
echo "<form method=post target=_blank>"
echo "<input name=thePath value=""" & HtmlEncode(Server.MapPath(".")) & """ size=80>"& vbNewLine
echo "<input type=hidden value=addToMdb name=theAct>"
echo "<select name=theMethod><option value=fso>FSO</option><option value=app>no-FSO</option>"& vbNewLine
echo "</select>"& vbNewLine
echo "<br><input type=submit value='p'>"& vbNewLine
echo "</form>"& vbNewLine
echo "<hr/>u(FSO):<br/>"& vbNewLine
echo "<form method=post target=_blank>"& vbNewLine
echo "<input name=thePath value=""" & HtmlEncode(Server.MapPath(".")) & "\badwolf.mdb"" size=80>"& vbNewLine
echo "<input type=hidden value=releaseFromMdb name=theAct><input type=submit value='u'>"& vbNewLine
echo "<hr/>"& vbNewLine
echo "</form>"& vbNewLine
echo "</body>"
echo "</html>"
End Sub
Sub addToMdb(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim rs, conn, stream, connStr, adoCatalog
Set rs = Server.CreateObject("ADODB.RecordSet")
Set stream = Server.CreateObject("ADODB.Stream")
Set conn = Server.CreateObject("ADODB.Connection")
Set adoCatalog = Server.CreateObject("ADOX.Catalog")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("badwolf.mdb")
adoCatalog.Create connStr
conn.Open connStr
conn.Execute("Create Table FileData(Id int IDENTITY(0,1) PRIMARY KEY CLUSTERED, thePath VarChar, fileContent Image)")
stream.Open
stream.Type = 1
rs.Open "FileData", conn, 3, 3
If Request("theMethod") = "fso" Then
fsoTreeForMdb thePath, rs, stream
Else
saTreeForMdb thePath, rs, stream
End If
rs.Close
Conn.Close
stream.Close
Set rs = Nothing
Set conn = Nothing
Set stream = Nothing
Set adoCatalog = Nothing
End Sub
Function fsoTreeForMdb(thePath, rs, stream)
Dim item, theFolder, folders, files, sysFileList
sysFileList = "$badwolf.mdb$badwolf.ldb$"
If fsoX.FolderExists(thePath) = False Then
showErr(thePath & " error!")
End If
Set theFolder = fsoX.GetFolder(thePath)
Set files = theFolder.Files
Set folders = theFolder.SubFolders
For Each item In folders
fsoTreeForMdb item.Path, rs, stream
Next
For Each item In files
If InStr(sysFileList, "$" & item.Name & "$") <= 0 Then
rs.AddNew
rs("thePath") = Mid(item.Path, 4)
stream.LoadFromFile(item.Path)
rs("fileContent") = stream.Read()
rs.Update
End If
Next
Set files = Nothing
Set folders = Nothing
Set theFolder = Nothing
End Function
Sub unPack(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Server.scrīptTimeOut = 5000
Dim rs, ws, str, conn, stream, connStr, theFolder
str = Server.MapPath(".") & "\"
Set rs = CreateObject("ADODB.RecordSet")
Set stream = CreateObject("ADODB.Stream")
Set conn = CreateObject("ADODB.Connection")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & thePath & ";"
conn.Open connStr
rs.Open "FileData", conn, 1, 1
stream.Open
stream.Type = 1
Do Until rs.Eof
theFolder = Left(rs("thePath"), InStrRev(rs("thePath"), "\"))
If fsoX.FolderExists(str & theFolder) = False Then
createFolder(str & theFolder)
End If
stream.SetEos()
stream.Write rs("fileContent")
stream.SaveToFile str & rs("thePath"), 2
rs.MoveNext
Loop
rs.Close
conn.Close
stream.Close
Set ws = Nothing
Set rs = Nothing
Set stream = Nothing
Set conn = Nothing
End Sub
Sub createFolder(thePath)
Dim i
i = Instr(thePath, "\")
Do While i > 0
If fsoX.FolderExists(Left(thePath, i)) = False Then
fsoX.CreateFolder(Left(thePath, i - 1))
End If
If InStr(Mid(thePath, i + 1), "\") Then
i = i + Instr(Mid(thePath, i + 1), "\")
Else
i = 0
End If
Loop
End Sub
Sub saTreeForMdb(thePath, rs, stream)
Dim item, theFolder, sysFileList
sysFileList = "$badwolf.mdb$badwolf.ldb$"
Set theFolder = saX.NameSpace(thePath)
For Each item In theFolder.Items
If item.IsFolder = True Then
saTreeForMdb item.Path, rs, stream
Else
If InStr(sysFileList, "$" & item.Name & "$") <= 0 Then
rs.AddNew
rs("thePath") = Mid(item.Path, 4)
stream.LoadFromFile(item.Path)
rs("fileContent") = stream.Read()
rs.Update
End If
End If
Next
Set theFolder = Nothing
End Sub
%>
二、php程序打包上传
首先,下载phpzip
如果你是一名菜鸟站长,而恰好你用的是php空间,又没有ftp支持,那么你一定不能错过phpZip。
下载回来的phpZip是一个rar压缩包,解压后有5个php文件,1个exe文件和一个dll文件,不要小看这几个文件,它们的功能可是大得很啊。
有了phpZip件,想传几个文件就传几个,再也不用怕没有ftp支持了,不过要注意的是不要超过空间单个文件上传大小限制。
1.我们上传PhpZip里的unzip.php(上传之前先用“记事本”打开它,找到第二行里 “$password = "isphp”这句,把其中的“isphp”改成自己的密码。PhpZip里的所有php文件都需进行此操作),看看 服务器是否支持zlib库,如果支持,就可以把文件压缩成Gzip格式,生成一个以gz为后缀的压缩包,可以大大减小文件体积;如果不支持,也没关系,只是压缩后的体积稍大了点。
2.运行phpZip.exe,点“浏览”可以选择要压缩的文件夹,如果服务器支持zlib库的话就选中“压缩成gzip格式”,点“压缩”就可以把文件压缩成一个gz压缩包,而“集成”选项可以把压缩选项等加入右键菜单,以便随时进行操作。把压缩好的文件包上传到网页空间,运行unzip.php,按提示即可把文件包在服务器端进行解压。
a.假如我们想在ftp空间中下载一个文件夹,而这个文件夹里又有上千个文件,那即便是用ftp软件下载也需要浪费很多时间,这时,zip.php这个文件就派上用场了。把zip.php上传到网页空间,运行后按照提示就可以在服务器端把ftp里的文件夹压缩成文件包,现在只需要下载一个文件就可以了。下载回来的文件包可以用phpZip.exe进行解压。
b. 由于php空间通常是建立在unix/linux系统上的,因此由于文件夹权限的设置,在ftp空间里经常会碰到一些删不掉的文件,通常我们会联系管理员帮助删除。其实不用这么麻烦,用phpZip自带的rm.php就可以强制删除这些文件,操作十分简单,“上传”,填入欲删除的文件的名字,点“确定”即可。
可能有的朋友在使用过程中会发现这几个php文件无法运行,这是由于服务器端的php版本太旧的缘故,不过不要失望,phpZip中的unzip.php3.php和zip.php3.php可以代替unzip.php和zip.php的功能,软件作者可是考虑得很周到的啊。