不用WinRar只有asp将网络空间上的文件打包下载(4)
Response.BinaryWrite objStream.Read
' Close it and go home
objStream.Close
Set objStream = Nothing
Set objInStream = Nothing
End Sub
' Build a header for each file and send the file contents
Private Sub ExportFile(sFilename,objOutStream,objInStream)
Dim lStart, lSum, lTemp
lStart = objOutStream.Position ' Record where we are up to
If IgnorePaths Then
' We ignore any paths prefixed to our filenames
lTemp = InStrRev(sFilename,"\")
if lTemp <> 0 then
sFilename = Right(sFilename,Len(sFilename) - lTemp)
end if
sFilename = BasePath & sFilename
End If
' Build the header, everything is ASCII in octal except for the data
objOutStream.WriteText Left(sFilename & String(100,Chr(0)),100)
objOutStream.WriteText "100" & Right("000" & Oct(Permissions),3) & " " & Chr(0) 'File mode
objOutStream.WriteText Right(String(6," ") & CStr(UserID),6) & " " & Chr(0) 'uid
objOutStream.WriteText Right(String(6," ") & CStr(GroupID),6) & " " & Chr(0) 'gid
objOutStream.WriteText Right(String(11,"0") & Oct(objInStream.Size),11) & Chr(0) 'size
objOutStream.WriteText Right(String(11,"0") & Oct(dateDiff("s","1/1/1970 10:00",now())),11) & Chr(0) 'mtime (Number of seconds since 10am on the 1st January 1970 (10am correct?)
objOutStream.WriteText " 0" & String(100,Chr(0)) 'chksum, type flag and link name, write out all blanks so that the actual checksum will get calculated correctly
objOutStream.WriteText "ustar " & Chr(0) 'magic and version
objOutStream.WriteText Left(UserName & String(32,Chr(0)),32) 'uname
objOutStream.WriteText Left(GroupName & String(32,Chr(0)),32) 'gname
objOutStream.WriteText " 40 " & String(4,Chr(0)) 'devmajor, devminor
内容版权声明:除非注明,否则皆为本站原创文章。