Upload | no component file:upload.asp
<%
' Author Philippe Collignon
' Email PhCollignon@email.com
Sub Builduploadrequest (Requestbin)
' Get the boundary
Posbeg = 1
Posend = InstrB (posbeg,requestbin,getbytestring (Chr (13)))
Boundary = MidB (Requestbin,posbeg,posend-posbeg)
Boundarypos = InstrB (1,requestbin,boundary)
' Get all data inside the boundaries
Do Until (BOUNDARYPOS=INSTRB (Requestbin,boundary & Getbytestring ("--)")
' members variable of the objects are put in a Dictionary object
Dim Uploadcontrol
Set Uploadcontrol = CreateObject ("Scripting.Dictionary")
' Get ' object name
Pos = InstrB (boundarypos,requestbin,getbytestring ("Content-disposition"))
Pos = InstrB (pos,requestbin,getbytestring ("Name="))
Posbeg = pos+6
Posend = InstrB (posbeg,requestbin,getbytestring (Chr (34)))
Name = getString (MidB (Requestbin,posbeg,posend-posbeg))
Posfile = InstrB (boundarypos,requestbin,getbytestring ("Filename="))
Posbound = InstrB (posend,requestbin,boundary)
' Test if object is of file type
If posfile<>0 and (Posfile<posbound) Then
' Get Filename, Content-type and content of file
Posbeg = Posfile + 10
Posend = InstrB (posbeg,requestbin,getbytestring (Chr (34)))
FileName = getString (MidB (Requestbin,posbeg,posend-posbeg))
' Add filename to Dictionary object
Uploadcontrol.add "filename", filename
Pos = InstrB (posend,requestbin,getbytestring ("Content-type:"))
Posbeg = pos+14
Posend = InstrB (posbeg,requestbin,getbytestring (Chr (13)))
' Add Content-type to Dictionary object
ContentType = getString (MidB (Requestbin,posbeg,posend-posbeg))
Uploadcontrol.add "ContentType", ContentType
' Get content of object '
Posbeg = posend+4
Posend = InstrB (posbeg,requestbin,boundary)-2
Value = MidB (Requestbin,posbeg,posend-posbeg)
Else
' Get content of object '
Pos = InstrB (pos,requestbin,getbytestring (Chr (13)))
Posbeg = pos+4
Posend = InstrB (posbeg,requestbin,boundary)-2
Value = getString (MidB (Requestbin,posbeg,posend-posbeg))
End If
' Add content to Dictionary object
Uploadcontrol.add "Value", value
&nbs