HttpPostedFile.ContentType Eigenschap

Definitie

Hiermee haalt u het MIME-inhoudstype op van een bestand dat door een client wordt verzonden.

public:
 property System::String ^ ContentType { System::String ^ get(); };
public string ContentType { get; }
member this.ContentType : string
Public ReadOnly Property ContentType As String

Waarde van eigenschap

Het MIME-inhoudstype van het geüploade bestand.

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u alle bestanden in de geüploade bestandsverzameling doorloopt en actie onderneemt wanneer het MIME-type van een bestand 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

Van toepassing op

Zie ook