Upravit

Sdílet prostřednictvím


HttpFileCollection.Get Method

Definition

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

Overloads

Get(Int32)

Returns the HttpPostedFile object with the specified numerical index from the file collection.

Get(String)

Returns the HttpPostedFile object with the specified name from the file collection.

Get(Int32)

Returns the HttpPostedFile object with the specified numerical index from the file collection.

public:
 System::Web::HttpPostedFile ^ Get(int index);
public System.Web.HttpPostedFile Get (int index);
member this.Get : int -> System.Web.HttpPostedFile
Public Function Get (index As Integer) As HttpPostedFile

Parameters

index
Int32

The index of the object to be returned from the file collection.

Returns

An HttpPostedFile object.

Examples

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

HttpFileCollection MyFileColl = Request.Files;
 HttpPostedFile MyPostedMember = MyFileColl.Get(0);
 String MyFileName = MyPostedMember.FileName;
Dim MyFileColl As HttpFileCollection = Request.Files
 Dim MyPostedMember As HttpPostedFile = MyFileColl.Get(0)
 Dim MyFileName As String = MyPostedMember.FileName

See also

Applies to

Get(String)

Returns the HttpPostedFile object with the specified name from the file collection.

public:
 System::Web::HttpPostedFile ^ Get(System::String ^ name);
public System.Web.HttpPostedFile Get (string name);
member this.Get : string -> System.Web.HttpPostedFile
Public Function Get (name As String) As HttpPostedFile

Parameters

name
String

The name of the object to be returned from a file collection.

Returns

An HttpPostedFile object.

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.

HttpFileCollection MyFileColl = Request.Files;
 HttpPostedFile MyPostedMember = MyFileColl.Get("CustInfo");
 String MyFileName = MyPostedMember.FileName;
Dim MyFileColl As HttpFileCollection = Request.Files
 Dim MyPostedMember As HttpPostedFile = MyFileColl.Get("CustInfo")
 Dim MyFileName As String = MyPostedMember.FileName

See also

Applies to