[Lazarus] Function to get the mimetype from a file extension

leledumbo leledumbo_cool at yahoo.co.id
Wed May 9 14:32:36 CEST 2012

No, we don't have a builtin one. However using any mime.types file (I forgot
where I got mine, it's either from one of fpweb/lnet demo or my apache/php
installation) you can do what you want:

TheMimeType := MimeTypes.GetMimeType(ExtractFileExt(AFileName));
// TheMimeType now contains, e.g., 'application/octet-stream'

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Function-to-get-the-mimetype-from-a-file-extension-tp3973851p3973966.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

More information about the Lazarus mailing list