asp实现文件浏览、上传、可下载文件源码。
发布时间:2023-09-19 09:55:48 所属栏目:Asp教程 来源:
导读:可以放在服务器上,对服务器上的文件进行浏览、上传、下载,可下载文件源码。
把下所有代码入在一个文件里即可,文件的后缀要为asp。
复制代码 代码如下:
<%
thedir = request("thedir")
if thedir = "
把下所有代码入在一个文件里即可,文件的后缀要为asp。
复制代码 代码如下:
<%
thedir = request("thedir")
if thedir = "
可以放在服务器上,对服务器上的文件进行浏览、上传、下载,可下载文件源码。 把下所有代码入在一个文件里即可,文件的后缀要为asp。 复制代码 代码如下: <% thedir = request("thedir") if thedir = "" then folderini = server.mappath(".")&"/" else folderini = server.mappath(thedir)&"/" end if foldinfo=trim(Request.Querystring("foldinfo")) if foldinfo = "" then foldinfo = folderini end if class clsUp Dim Form,File Dim AllowExt_ Dim NoAllowExt_ Private oUpFileStream Private isErr_ Private ErrMessage_ Private isGetData_ Public Property Get Version Version="v1.0.0" End Property Public Property Get isErr isErr=isErr_ End Property Public Property Get ErrMessage ErrMessage=ErrMessage_ End Property Public Property Get AllowExt AllowExt=AllowExt_ End Property Public Property Let AllowExt(Value) AllowExt_=LCase(Value) End Property Public Property Get NoAllowExt NoAllowExt=NoAllowExt_ End Property Public Property Let NoAllowExt(Value) NoAllowExt_=LCase(Value) End Property Private Sub Class_Initialize isErr_ = 0 NoAllowExt="" NoAllowExt=LCase(NoAllowExt) AllowExt="" AllowExt=LCase(AllowExt) isGetData_=false End Sub Private Sub Class_Terminate on error Resume Next Form.RemoveAll Set Form = Nothing File.RemoveAll Set File = Nothing oUpFileStream.Close Set oUpFileStream = Nothing End Sub Public Sub GetData (MaxSize) on error Resume Next if isGetData_=false then Dim getupdata1,sSpace,bCrLf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,oFileInfo Dim sFormValue,sFileName Dim iFindStart,iFindEnd Dim iFormStart,iFormEnd,sFormName If Request.TotalBytes < 1 Then isErr_ = 1 ErrMessage_="" Exit Sub End If If MaxSize > 0 Then If Request.TotalBytes > MaxSize Then isErr_ = 2 ErrMessage_="" Exit Sub End If End If Set Form = Server.CreateObject ("Scripting.Dictionary") Form.CompareMode = 1 Set File = Server.CreateObject ("Scripting.Dictionary") File.CompareMode = 1 Set tStream = Server.CreateObject ("ADODB.Stream") Set oUpFileStream = Server.CreateObject ("ADODB.Stream") oUpFileStream.Type = 1 oUpFileStream.Mode = 3 oUpFileStream.Open oUpFileStream.Write Request.BinaryRead (Request.TotalBytes) oUpFileStream.Position = 0 getupdata1 = oUpFileStream.Read iFormEnd = oUpFileStream.Size bCrLf = ChrB (13) & ChrB (10) (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐