使用 Persits 获取项目文本 Asp.Upload

Get Item Text with Persits Asp.Upload

我需要组件 Persits 的 AspUpload 方面的帮助。我需要一个简单的方法来从表单中获取项目文本。我在线阅读了手册http://www.aspupload.com/manual_simple.html,但我认为提供的方法并不好。在手册中使用的方法是:

<%
For Each Item in Upload.Form
Response.Write Item.Name & "= " & Item.Value & "<BR>"
Next
%>

我需要从项目中获取 item.value。我已经知道 item.name。我尝试使用此代码,但它没有 运行

var1 = Upload.Form.Item.Name("var1").Item.Value

错误是:

Wrong number of arguments or invalid property assignment: 'Upload.Form.Item'

我找到了解决方案,但我不喜欢它

For Each Item in Upload.Form
    if Item.Name = "var1" then var1=Item.Value end if
Next

你有没有更优雅的解决方案?谢谢

诚然,文档不是最清晰的,但 Upload.Formdocumentation says;

的集合

To reference an individual form item of the collection you may use a 1-based integer index, or a string corresponding to the NAME attribute of a text item of your upload form.

因此您可以像经典中的大多数合集一样访问它 ASP

name = Upload.Form("var1").Name
value = Upload.Form("var1").Value

只要var1等于HTML表单域元素的NAME属性(INPUT,SELECT, TEXTAREA 等).