HttpRequest.Files 속성

정의

클라이언트에서 업로드한 파일 컬렉션을 multipart MIME 형식으로 가져옵니다.

public:
 property System::Web::HttpFileCollection ^ Files { System::Web::HttpFileCollection ^ get(); };
public System.Web.HttpFileCollection Files { get; }
member this.Files : System.Web.HttpFileCollection
Public ReadOnly Property Files As HttpFileCollection

속성 값

HttpFileCollection

클라이언트에서 업로드한 파일 컬렉션을 나타내는 HttpFileCollection 개체입니다. HttpFileCollection 개체의 항목은 HttpPostedFile 형식입니다.

예제

다음 코드 예제에서는 컬렉션에 있는 모든 파일의 이름을 표시 합니다 Files .

int loop1;
HttpFileCollection Files;

Files = Request.Files; // Load File collection into HttpFileCollection variable.
arr1 = Files.AllKeys;  // This will get names of all files into a string array.
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
    Response.Write("File: " + Server.HtmlEncode(arr1[loop1]) + "<br />");
    Response.Write("  size = " + Files[loop1].ContentLength + "<br />");
    Response.Write("  content type = " + Files[loop1].ContentType + "<br />");
}

Dim loop1 As Integer
 Dim arr1() As String
 Dim Files As HttpFileCollection
 
 Files = Request.Files ' Load File collection into HttpFileCollection variable.
 arr1 = Files.AllKeys ' This will get names of all files into a string array.
        For loop1 = 0 To arr1.GetUpperBound(0)
            Response.Write("File: " & Server.HtmlEncode(arr1(loop1)) & "<br>")
            Response.Write("  size = " + Files(loop1).ContentLength + "<br />")
            Response.Write("  content type = " + Files(loop1).ContentType + "<br />")
        Next loop1

설명

파일 컬렉션은 HTTP 요청 Content-Type 값이 "multipart/form-data"인 경우에만 채워집니다.

적용 대상