HttpPostedFile.ContentType Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the MIME content type of a file sent by a client.
public:
property System::String ^ ContentType { System::String ^ get(); };
public string ContentType { get; }
member this.ContentType : string
Public ReadOnly Property ContentType As String
Property Value
The MIME content type of the uploaded file.
Examples
The following code example shows how to loop through all the files in the uploaded file collection and take action when the MIME type of a file is US-ASCII
.
HttpFileCollection MyFileCollection = Request.Files;
for (int Loop1 = 0; Loop1 < MyFileCollection.Count; Loop1++)
{
if (MyFileCollection[Loop1].ContentType == "video/mpeg")
{
//...
}
}
Dim Loop1 As Integer
Dim MyFileCollection As HttpFileCollection = Request.Files
For Loop1 = 0 To MyFileCollection.Count - 1
If MyFileCollection(Loop1).ContentType = "video/mpeg" Then
'...
End If
Next Loop1
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET