asp 调用java文件上传_用asp实现文件浏览、上传、下载的程序

这个ASP程序提供了文件浏览、上传和下载的功能。它包含了一个名为clsUp的类,用于处理文件上传,包括限制文件大小和检查文件扩展名。另外,还提供了删除文件和目录的功能,以及文件下载和显示文件信息的方法。通过调用Java实现文件上传,适用于服务器文件管理。
摘要由CSDN通过智能技术生成

可以放在服务器上,对服务器上的文件进行浏览、上传、下载,可下载文件源码。

把下所有代码入在一个文件里即可,文件的后缀要为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 

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.Pos

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值