HttpPostedFile.ContentType 属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取客户端发送的文件的 MIME 内容类型。
public:
 property System::String ^ ContentType { System::String ^ get(); };public string ContentType { get; }member this.ContentType : stringPublic ReadOnly Property ContentType As String属性值
上载文件的 MIME 内容类型。
示例
下面的代码示例演示如何循环访问上传的文件集合中的所有文件,并在文件的 MIME 类型为 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