This class is the most crucial of all because it contains all the information
regarding the uploaded files. It also works equivalent to ASP's Request.Form
in a way that it can bring the value of the specified
field in almost similar fashion. Its instance is created by
the upper classes ( FileUp and
SAFile ). It cannot be instantiated
independently.
It offers the following properties:
Property Descriptions
Item Property
This method brings the value of the field whose name is specified in
either the argument i.e.'fieldname' of this method or in the ' form'
method.
Example
Html page:
<HTML><HEAD>
<TITLE>Getting values of fields </TITLE>
</HEAD>
<BODY>
<FORM enctype="multipart/form-data" method="post"
action="sample2.asp">
<SELECT NAME="CHIOICE" >
<OPTION>Image
<OPTION>Text
<OPTION>Source Code
<OPTION>Archive
</SELECT>
<BR>
<INPUT TYPE=TEXT NAME="DESCRIPTION"><BR>
<INPUT TYPE=FILE NAME="FILE1">
<BR>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>
Script for 'sample2.asp':
<%
Set obj = Server.CreateObject("SoftArtisans.FileUp")
choice=obj.form("CHOICE").Item
des=obj.form("DESCRIPTION").Item
' and not obj.form("DESCRIPTION")
file=obj.form.Item("FILE1")
'another way of calling
Response.Write
choice
Response.Write des
Response.Write file
%>
It is important to note that the values cannot be accessed simply by
writing obj.form("fieldname"), rather the method of 'Item' has to be called
on the 'form' method.
Count Property
This is a Read-Only property. Count is the number of fields present
on the Form.
Example
Html page
<HTML><HEAD>
<TITLE>Getting values of fields </TITLE>
</HEAD>
<BODY>
<FORM enctype="multipart/form-data" method="post"
action="sample2.asp">
<SELECT NAME="CHIOICE" >
<OPTION>Image
<OPTION>Text
<OPTION>Source Code
<OPTION>Archive
</SELECT>
<BR>
<INPUT TYPE=TEXT NAME="DESCRIPTION"><BR>
<INPUT TYPE=FILE NAME="FILE1"><BR>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>
Script for 'sample2.asp':
<%
Set obj = Server.CreateObject("SoftArtisans.FileUp")
count = obj.Count
Response.Write count 'returns
4 in this case.
%>
|