HttpPostedFile.ContentType Property
.NET Framework 2.0
Gets the MIME content type of a file sent by a client.
Namespace: System.Web
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
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 = get_Request().get_Files();
for (int loop1 = 0; loop1 < myFileCollection.get_Count(); loop1++) {
if (myFileCollection.get_Item(loop1).get_ContentType().
Equals("video/mpeg")) {
//...
}
}
var myFileCollection : HttpFileCollection = Request.Files for(var i=0; i < myFileCollection.Count; i++){ if(myFileCollection[i].ContentType == "video/mpeg"){ //... } }
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show: