Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting file type for a Flash file
Message
From
14/12/2005 16:31:39
 
 
To
14/12/2005 03:13:46
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01077743
Message ID:
01078049
Views:
24
>I checked a number of SWF files with Vernon D. Buerg's good old List in HEX mode, and unless there are more version of the file format, this modified FileType function should do the trick.
>Function filetype
>  Lparameters lcData
>  Local lcReturn,lcContents
>  If Pcount()=0 or Vartype(lcData)#'C'
>    lcReturn=''
>  Else
>    If ADir(laDummy,lcData)>0 && File
>      lcContents=FileToStr(lcData)
>    Else && Memory variabøe
>      lcContents=lcData
>    EndIf
>    Do case
>      Case Len(lcContents)<4
>        lcReturn=''
>      Case left(lcContents,3)=CHR(0xFF)+CHR(0xD8)+CHR(0xFF)
>        lcReturn='JPG'
>      Case left(lcContents,3)='GIF'
>        lcReturn='GIF'
>      Case substr(lcContents,42,3)='EMF'
>        lcReturn='EMF'
>      Case left(lcContents,4)=CHR(0xD7)+CHR(0xCD)+CHR(0xC6)+CHR(0x9A)
>        lcReturn='WMF'
>      Case left(lcContents,4)=CHR(0x4D)+CHR(0x4D)+CHR(0x00)+CHR(0x2A)
>        lcReturn='TIF'
>      Case left(lcContents,4)=CHR(0x89)+'PNG'
>        lcReturn='PNG'
>      Case left(lcContents,2)='BM'
>        lcReturn='BMP'
>      Case left(lcContents,4)='CWS'+CHR(0x06)
>        lcReturn='SWF'
>      Case left(lcContents,4)='FWS'+CHR(0x04)
>        lcReturn='SWF'
>      Otherwise
>        lcReturn=''
>    EndCase
>  EndIf
>Return lcReturn
I am sending you a SWF file by email. You will be able to test it with your function. It has the first three characters ok but the fourth one, the one with the hexadecimal reference, does not match. I would appreciate if you could try to see what adjustment need to be done in here. TIA
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform