Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adjustment on detecting file type
Message
From
21/09/2006 16:31:38
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Adjustment on detecting file type
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01156196
Message ID:
01156196
Views:
66
I just found that the following code cannot handle GIF recognition if the file is a GIF animated. Anyone would know what I would need to adjust to recognize that format as a GIF file?
        ' Return the file type
        ' expC1 File name with the full path
        Public Function FileType(ByVal tcFile As String) As String
            Dim lcString As String = ""
            lcString = FileToStr(tcFile)

            If lcString.Length < 4 Then
                Return ""
            End If

            If Left(lcString, 3) = Chr(255) + Chr(232) + Chr(255) Then
                Return "JPG"
            End If

            If Left(lcString, 3) = "GIF" Then
                Return "GIF"
            End If

            If Mid(lcString, 42, 3) = "EMF" Then
                Return "EMF"
            End If

            If Left(lcString, 4) = Chr(215) + Chr(205) + Chr(198) + Chr(154) Then
                Return "WMF"
            End If

            If Left(lcString, 4) = Chr(77) + Chr(77) + Chr(0) + Chr(42) Then
                Return "TIF"
            End If

            If Left(lcString, 4) = Chr(137) + "PNG" Then
                Return "PNG"
            End If

            If Left(lcString, 2) = "BM" Then
                Return "BMP"
            End If

            If Left(lcString, 3) = "CWS" And Asc(Mid(lcString, 4, 1)) < 16 Then
                Return "SWF"
            End If

            If Left(lcString, 3) = "FWS" And Asc(Mid(lcString, 4, 1)) < 16 Then
                Return "SWF"
            End If

            Return ""
        End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Reply
Map
View

Click here to load this message in the networking platform