'----file name/upaoad.asp/
<%
Public Function builduploadrequest (strrequestbin)
Dim Posbeg, Posend, boundary, Boundarypos
' Get the boundary
Posbeg = 1
Posend = InstrB (posbeg,strrequestbin,getbytestring (Chr (13)))
Boundary = MidB (Strrequestbin,posbeg,posend-posbeg)
Boundarypos = InstrB (1,strrequestbin,boundary)
' Get all data inside the boundaries
Do Until (Boundarypos = InstrB (Strrequestbin,boundary & Getbytestring ("--)")
' members variable of the objects are put in a Dictionary object
Dim Uploadcontrol
Set Uploadcontrol = CreateObject ("Scripting.Dictionary")
Dim Pos, Name
' Get ' object name
Pos = InstrB (boundarypos,strrequestbin,getbytestring ("Content-disposition"))
Pos = InstrB (pos,strrequestbin,getbytestring ("Name="))
Posbeg = Pos + Len ("name=") + 1
Posend = InstrB (posbeg,strrequestbin,getbytestring (Chr (34)))
Name = getString (MidB (Strrequestbin,posbeg,posend-posbeg))
Dim Posfile, Posbound, ContentType, Value
' Test if object is of file type
Posfile = InstrB (boundarypos,strrequestbin,getbytestring ("Filename="))
Posbound = InstrB (posend,strrequestbin,boundary)
If posfile <> 0 and Posfile < Posbound Then
' Get filepathname of the ' file
Posbeg = Posfile + Len ("filename=") + 1
Posend = InstrB (posbeg,strrequestbin,getbytestring (Chr (34)))
Filepathname = getString (MidB (Strrequestbin,posbeg,posend-posbeg))
' ADD filename (with path) to Dictionary object
Uploadcontrol.add "Filepathname", filepathname
' Get Content-type of the ' file
Pos = InstrB (posend,strrequestbin,getbytestring ("Content-type:"))
Posbeg = Pos + Len ("Content-type:") + 1
Posend = InstrB (posbeg,strrequestbin,getbytestring (Chr (13)))
ContentType = getString (MidB (Strrequestbin,posbeg,posend-posbeg))
' Add Content-type to Dictionary object
Uploadcontrol.add "ContentType", ContentType
' Get content of object '
Posbeg = Posend + 4
Posend = InstrB (posbeg,strrequestbin,boundary)-2
Value = MidB (Strrequestbin,posbeg,posend-posbeg)
Else
' Get content of object '
Pos = InstrB (pos,strrequestbin,getbytestring (Chr (13)))
Posbeg = Pos + 4
Posend = InstrB (posbeg,strrequestbin,boundary)-2
Value = getString (MidB (Strrequestbin,posbeg,posend-posbeg))
End If
' Add content to Dictionary object
Uploadcontrol.add "Value", value
' Add Dictionary object to main dictionary
Set uploadrequest (Name) = Uploadcontrol
' Loop to Next object '
Boundarypos = InstrB (Boundarypos+lenb (boundary), strrequestbin,boundary)
Loop
End Function
' String to byte string conversion
Public Function getbytestring (strstring)
Dim intcount
getbytestring = ""
For intcount = 1 to Len (strstring)
getbytestring = getbytestring & ChrB (AscB (Mid (strstring,intcount,1))
Next
End Function
' Byte string to string conversion
Public Function getString (strstring)
Dim intcount
getString = ""
For intcount = 1 to LenB (strstring)
getString = getString & Chr (AscB (MidB (strstring,intcount,1))
Next
End Function
%>