YPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w***3.org/TR/REC-html40/loose.dtd">
YPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.***w3.org/TR/REC-html40/loose.dtd">
''此例子文档编码都是UTF-8,如果是其他编码的系统,请将编码转换为相应的编码,不然表单获取数据可能会乱码
Dim objUpload,opt
Dim xmlPath
Dim fileFormName,objFile,counter
opt = request.QueryString("opt")
If opt = "Upload" Then
xmlPath = Server.MapPath(request.QueryString("xmlPath"))''将虚拟路径转换为实际路径
Set objUpload=new SundyUpload ''建立上传对象
objUpload.UploadInit xmlPath,"utf-8"
counter = 1
Response.Write("普通表单:" & objUpload.Form("normalForm") & "
")''获取表单数据
For Each fileFormName In objUpload.objFile
Set objFile=objUpload.objFile(fileFormName)
fileSize = objFile.FileSize
strTemp= objFile.FilePath
Response.Write strTemp
fileName = mid(strTemp,InStrRev(strTemp, "\")+1)
If fileSize > 0 Then
Response.Write("File Size:" & fileSize & "
")
Response.Write("File Name:" & objFile.FilePath & "
")
'' Response.Write("File Description:" & objUpload.Form("fileDesc" & counter) & "
")
objFile.SaveAs Server.MapPath(".") & "\upload\" & fileName
Response.Write "Save at: "&Server.MapPath(".") & "\upload\" & fileName & "
"
End If
counter = counter + 1
Next
End If
''为上载进度条数据文件(XML文件指定虚拟路径)
''最好是随机的,因为可能多个人同时上载,需要不同的进度数据
''这个路径需要在提交的时候传入上载组件中,以便在上载过程中更改进度数据
''客户端使用javascript来读取此XML文件,显示进度
xmlPath = "upload/" & Timer & ".xml"
%>
SundyUpload.asp
Dim SundyUpload_SourceData
Class SundyUpload
Dim objForm,objFile,Version,objProgress
Dim xmlPath,CharsetEncoding
Public Function Form(strForm)
strForm=lcase(strForm)
If NOT objForm.exists(strForm) Then
Form=""
Else
Form=objForm(strForm)
End If
End Function
Public Function File(strFile)
strFile=lcase(strFile)
If NOT objFile.exists(strFile) Then
Set File=new FileInfo
Else
Set File=objFile(strFile)
End If
End Function
Public Sub UploadInit(progressXmlPath,charset)
Dim RequestData,sStart,Crlf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,theFile
Dim iFileSize,sFilePath,sFileType,sFormValue,sFileName
Dim iFindStart,iFindEnd
Dim iFormStart,iFormEnd,sFormName
Version="Upload Width Progress Bar Version 1.0"
Set objForm=Server.CreateObject("Scripting.Dictionary")
Set objFile=Server.CreateObject("Scripting.Dictionary")
If Request.TotalBytes
Set tStream = Server.CreateObject("adodb.stream")
Set SundyUpload_SourceData = Server.CreateObject("adodb.stream")
SundyUpload_SourceData.Type = 1
SundyUpload_SourceData.Mode =3
SundyUpload_SourceData.Open
Dim TotalBytes
Dim ChunkReadSize
Dim DataPart, PartSize
Dim objProgress
TotalBytes = Request.TotalBytes '' 总大小
ChunkReadSize = 64 * 1024 '' 分块大小64K
BytesRead = 0
xmlPath = progressXmlPath
CharsetEncoding = charset
If CharsetEncoding = "" Then
CharsetEncoding = "utf-8"
End If
Set objProgress = New Progress
objProgress.ProgressInit(xmlPath)
objProgress.UpdateProgress Totalbytes,0
''循环分块读取
Do While BytesRead
''分块读取
PartSize = ChunkReadSize
If PartSize + BytesRead > TotalBytes Then PartSize = TotalBytes - BytesRead
DataPart = Request.BinaryRead(PartSize)
BytesRead = BytesRead + PartSize
SundyUpload_SourceData.Write DataPart
objProgress.UpdateProgress Totalbytes,BytesRead
Loop
''SundyUpload_SourceData.Write Request.BinaryRead(Request.TotalBytes)
SundyUpload_SourceData.Position=0
RequestData =SundyUpload_SourceData.Read
iFormStart = 1
iFormEnd = LenB(RequestData)
Crlf = chrB(13) & chrB(10)
sStart = MidB(RequestData,1, InStrB(iFormStart,RequestData,Crlf)-1)
iStart = LenB (sStart)
iFormStart=iFormStart+iStart+1
While (iFormStart + 10)
iInfoEnd = InStrB(iFormStart,RequestData,Crlf & Crlf)+3
tStream.Type = 1
tStream.Mode =3
tStream.Open
SundyUpload_SourceData.Position = iFormStart
SundyUpload_SourceData.CopyTo tStream,iInfoEnd-iFormStart
tStream.Positio
原神祈愿模拟器最新版
原神祈愿模拟器手机版是一款完整汉化的趣味原神抽卡模拟小游戏,
宝宝森林美食完整版
宝宝森林美食游戏最新版是一款十分有趣的休闲益智游戏,帮助宝宝
g沙盒仇恨官方英文版(gorebox)
G沙盒仇恨英文原版是一款最近非常火热的沙盒模拟类游戏,在这里
迷你世界测试服最新版2024
迷你世界测试服2021最新版,即迷你世界的先遣服版本,用户能
闪耀暖暖最新版2024
闪耀暖暖手游这是非常好玩的换装手游,游戏内容丰富有趣,游戏环