Szerkesztés

Megosztás a következőn keresztül:


HttpFileCollection.Item[] Property

Definition

Gets an individual HttpPostedFile object from the file collection. This property is overloaded to allow retrieval of objects by either name or numerical index.

Overloads

Item[Int32]

Gets the object with the specified numerical index from the HttpFileCollection.

Item[String]

Gets the object with the specified name from the file collection.

Item[Int32]

Gets the object with the specified numerical index from the HttpFileCollection.

public:
 property System::Web::HttpPostedFile ^ default[int] { System::Web::HttpPostedFile ^ get(int index); };
public System.Web.HttpPostedFile this[int index] { get; }
member this.Item(int) : System.Web.HttpPostedFile
Default Public ReadOnly Property Item(index As Integer) As HttpPostedFile

Parameters

index
Int32

The index of the item to get from the file collection.

Property Value

The HttpPostedFile specified by index.

Examples

The following example retrieves the first file object (index = 0) from the collection sent by the client and retrieves the name of the actual file represented by the object.

HttpPostedFile MyPostedMember = Request.Files[0];
 String MyFileName = MyPostedMember.FileName;
Dim MyPostedMember As HttpPostedFile = Request.Files(0)
 Dim MyFileName As String = MyPostedMember.FileName

See also

Applies to

Item[String]

Gets the object with the specified name from the file collection.

public:
 property System::Web::HttpPostedFile ^ default[System::String ^] { System::Web::HttpPostedFile ^ get(System::String ^ name); };
public System.Web.HttpPostedFile this[string name] { get; }
member this.Item(string) : System.Web.HttpPostedFile
Default Public ReadOnly Property Item(name As String) As HttpPostedFile

Parameters

name
String

Name of item to be returned.

Property Value

The HttpPostedFile specified by name.

Examples

The following example retrieves the file object named "CustInfo" from the collection sent by the client and retrieves the name of the actual file represented by the object.

HttpPostedFile MyPostedMember = Request.Files["CustInfo"];
 String MyFileName = MyPostedMember.FileName;
Dim MyPostedMember As HttpPostedFile = Request.Files("CustInfo")
 Dim MyFileName As String = MyPostedMember.FileName

See also

Applies to