HttpPostedFile.ContentType Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar MIME-innehållstypen för en fil som skickas av en klient.
public:
property System::String ^ ContentType { System::String ^ get(); };
public string ContentType { get; }
member this.ContentType : string
Public ReadOnly Property ContentType As String
Egenskapsvärde
MIME-innehållstypen för den uppladdade filen.
Exempel
I följande kodexempel visas hur du loopar igenom alla filer i den uppladdade filsamlingen och vidtar åtgärder när MIME-typen av en fil är 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