>Check the first few bytes of the file! >JPG starts with FF-D8-FF-00 (hex) or chr(255)+chr(216)+chr(255)+chr(0) >GIF starts with GIF (plain text) >PNG starts wiyh 89-50-E4-47 (hex) which is chr(37)+'PNG'
This doesn't work.
* First, make sure this is a JPG
lcString=FILETOSTR(This.cSavePath)
IFSUBSTR(lcString,1,4)<>CHR(255)+CHR(216)+CHR(255)+CHR(0)
This.cHtml='This is not a JPG file.'ERASE (This.cSavePath)
RETURN .F.
ENDIF