Hi,
A long time ago I think that we were reading the first 80 - 100 characters of a blob field to see if we could tell if it was a TXT, PDF, HTML, BMP, JPG. I can’t find the code we used.
Thanks for any info.
Ron
I would probably just ask my favorite robot to write a function based on this https://www.npmjs.com/package/file-type
I was looking for blob stuff and I found this very old post in my files: It looks at the first 50 chars of a blob and tries to determine the extension of the file if possible.
Ron
This is the code used to define the “type” (if possible)
IF INSTRING('HTML',UPPER(LEFT(SelectedRowQEIP,50)),1,1)
SELECT(?TabHTML)
ELSIF INSTRING('XML',UPPER(LEFT(SelectedRowQEIP,50)),1,1)
SELECT(?TabXML)
ELSIF INSTRING('RTF',UPPER(LEFT(SelectedRowQEIP,50)),1,1)
SELECT(?TabRTF)
ELSIF INSTRING('PDF',UPPER(LEFT(SelectedRowQEIP,50)),1,1)
SELECT(?TabPDF)
ELSIF UPPER(LEFT(SelectedRowQEIP,3)) = 'CWS' OR UPPER(LEFT(SelectedRowQEIP,3)) = 'FWS'
SELECT(?TabSWF)
ELSIF UPPER(LEFT(SelectedRowQEIP,2)) = 'BM' OR INSTRING('EXIF',UPPER(LEFT(SelectedRowQEIP,50)),1,1) OR INSTRING('JFIF',UPPER(LEFT(SelectedRowQEIP,50)),1,1) OR
INSTRING(‘GIF’,UPPER(LEFT(SelectedRowQEIP,50)),1,1) OR INSTRING(‘PNG’,UPPER(LEFT(SelectedRowQEIP,50)),1,1)
SELECT(?TabImage)
END
where SelectedRowQEIP is filled with from the blob
SelectedRowQEIP &= null
SelectedRowQEIP = what(…)
Cordialement - Best regards
Jean-Pierre GUTSATZ