PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Get mime type of local file
Get mime type of local file
Débuté par Darryl Meganoski, 05 déc. 2017 16:46 - 2 réponses
Posté le 05 décembre 2017 - 16:46
Pulling my hair out over this one. I cannot seem to find any information about this anywhere.

I have a procedure that recursively scans a directory and gathers some information about the files within it.

I need to determine the mime type of the files. fExtractPath does not seem to do this. I would rather not rely on the file's extension.

What would be the suggested way to do this in windev?
Posté le 05 décembre 2017 - 19:22
Hi Darryl

if you do not want to rely on the extension, you have to analyse the
CONTENT of the file (usually the first 256 bytes is enough) and compare
it to a reference like
http://www.optimasc.com/products/fileid/magic-format.pdf

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 12/5/2017 à 10:46 AM, Darryl Meganoski a écrit :
Pulling my hair out over this one. I cannot seem to find any information
about this anywhere.
I have a procedure that recursively scans a directory and gathers some
information about the files within it.
I need to determine the mime type of the files. fExtractPath does not
seem to do this. I would rather not rely on the file's extension.

What would be the suggested way to do this in windev?
Posté le 07 décembre 2017 - 22:43
Great, thanks for the tip. I'll try that.