日期:2010-05-11 浏览次数:21029 次
</html>
----------------------------------
Upload.asp的内容:
----------------------------------
<%
Response.Buffer = TRUE
Response.Clear
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
'response.binarywrite requestbin
'取得表单的全部内容
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
' UploadRequest结构将用来存放表单
PosBeg = 1
PosEnd = InstrB(PosBeg,RequestBin,StoB(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
'求字段间的分隔串(即:-----------------------------7d029e347d8 )
boundaryPos = InstrB(1,RequestBin,boundary)
Do until (boundaryPos=InstrB(RequestBin,boundary & StoB("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
'Get an object name
Pos = InstrB(BoundaryPos,RequestBin,StoB("Content-Disposition"))
Pos = InstrB(Pos,RequestBin,StoB("name="))
PosBeg = Pos+6
PosEnd = InstrB(PosBeg,RequestBin,StoB(chr(34)))
Name = BtoS(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile = InstrB(BoundaryPos,RequestBin,StoB("filename="))
PosBound = InstrB(PosEnd,RequestBin,boundary)
' response.write "<hr>"
' response.write "name="&name&"<BR>"
' name为表单项的名字
'Test if object is of file type
If PosFile<>0 AND (PosFile<PosBound) Then
PosBeg = PosFile + 10
PosEnd = InstrB(PosBeg,RequestBin,StoB(chr(34)))
FileName = BtoS(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
' response.write "<BR>"
' response.write "filename="&filename&"<BR>"
' filename为全路径文件名(如果是文件类型话)
UploadControl.Add "FileName", FileName
Pos = InstrB(PosEnd,RequestBin,StoB("Content-Type:"))
PosBeg = Pos+1