HttpFileCollection.Get Metoda

Definicja

Zwraca pojedynczy HttpPostedFile obiekt z kolekcji plików. Ta właściwość jest przeciążona, aby umożliwić pobieranie obiektów według nazwy lub indeksu liczbowego.

Przeciążenia

Get(Int32)

HttpPostedFile Zwraca obiekt z określonym indeksem liczbowym z kolekcji plików.

Get(String)

HttpPostedFile Zwraca obiekt o określonej nazwie z kolekcji plików.

Get(Int32)

HttpPostedFile Zwraca obiekt z określonym indeksem liczbowym z kolekcji plików.

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

Parametry

index
Int32

Indeks obiektu, który ma zostać zwrócony z kolekcji plików.

Zwraca

HttpPostedFile

Obiekt HttpPostedFile.

Przykłady

Poniższy przykład pobiera pierwszy obiekt pliku (indeks = 0) z kolekcji wysłanej przez klienta i pobiera nazwę pliku reprezentowanego przez obiekt.

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

Zobacz też

Dotyczy

Get(String)

HttpPostedFile Zwraca obiekt o określonej nazwie z kolekcji plików.

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

Parametry

name
String

Nazwa obiektu, który ma zostać zwrócony z kolekcji plików.

Zwraca

HttpPostedFile

Obiekt HttpPostedFile.

Przykłady

Poniższy przykład pobiera obiekt pliku o nazwie "CustInfo" z kolekcji wysłanej przez klienta i pobiera nazwę rzeczywistego pliku reprezentowanego przez obiekt.

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

Zobacz też

Dotyczy