Get the HTMLInputFile contenttype to get the extension and validate the same which is stored in an array..
Note: Add in all the image types available into the array
Dim extension as string =MyFile.PostedFile.ContentType
Dim IsImage As Boolean = False
Dim estr() As String = {"image/gif", "image/pjpeg", "image/bmp", "image/jpeg", "image/png", "image/jpg"}
Dim i As Integer
For i = 0 To estr.Length - 1
If estr(i) = extension Then
IsImage = True
End If
Next
No comments:
Post a Comment