HttpPostedFile.ContentType Property
.NET Framework 3.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"){ //... } }
Community Additions
ADD
Show: