这里是完成。仍是存成doupload.asp:
<%
'=========================================================================
'' 这个,是存储文本域信息的的类。每个name的文本域,对应一个如许的类。
'=========================================================================
Class FormElement
' m_开首,暗示类成员变量。
Private m_dicItems
Private Sub Class_Initialize()
Set m_dicItems = Server.CreateObject("Scripting.Dictionary")
End Sub
' count是我们这个类的一个只读属性
Public Property Get Count()
Count = m_dicItems.Count
End Property
' Value是一个默许属性。目标是失掉值
Public Default Property Get Value()
Value = Item("")
End Property
' Name是失掉文本域称号。就是<input name=xxx>里的xxx
Public Property Get Name()
Keys = m_dicItems.Keys
Name = Keys(0)
Name = left(Name,instrrev(Name,"_")-1)
End Property
' Item属性用来失掉重名表单域(好比checkbox)的某一个值
Public Property Get Item(index)
If isNumeric(index) Then '是数字,正当!
If index > m_dicItems.Count-1 Then
err.raise 1,"IndexOutOfBound", "表单位素子集索引越界"
End If
Itms = m_dicItems.Items
Item = Itms(index)
ElseIf index = "" Then '没给值?那就前往一切的!逗号分隔
Itms = m_dicItems.Items
For i = 0 to m_dicItems.Count-1
If i = 0 Then
Item = Itms(0)
Else
Item = Item & "," & Itms(i)
End If
Next
Else '给个一个不是数字的东东?失足!
err.raise 2,"IllegalArgument", "不法的表单位素子集索引"
End If
End Property
Public Sub Add(key, item)
m_dicItems.Add key, item
End Sub
End Class
'=========================================================================
'' 这个,是存储文件域信息的的类。每个name的文件,对应一个如许的类。
'=========================================================================
Class FileElement