Mime Types

FWIW: Here is something to keep you from typing mime type tables. (yea I know a database is better–but this is quick and dirty)

[code]dim extension as string
dim mime_type as string

Select case extension

case “.aac”
mime_type=“audio/aac”
case “.avi”
mime_type=“video/x-msvideo”
case “.doc”
mime_type=“application/msword”
case “.epub”
mime_type=“application/epub+zip”
case “.gif”
mime_type=“image/gif”
case “.htm”
mime_type=“text/html”
case “.html”
mime_type=“text/html”
case “.ics”
mime_type=“text/calendar”
case “.jar”
mime_type=“application/java-archive”
case “.jpg”
mime_type=“image/jpeg”
case “.jpeg”
mime_type=“image/jpeg”
case “.js”
mime_type=“application/javascript”
case “.json”
mime_type=“application/json”
case “.mid”
mime_type=“audio/midi”
case “.midi”
mime_type=“audio/midi”
case “.mpeg”
mime_type=“video/mpeg”
case “.mpkg”
mime_type=“application/vnd.apple.installer+xmlt”
case “.odp”
mime_type=“application/vnd.oasis.opendocument.presentation”
case “.ods”
mime_type=“application/vnd.oasis.opendocument.spreadsheet”
case “.odt”
mime_type=“application/vnd.oasis.opendocument.text”
case “.oga”
mime_type=“audio/ogg”
case “.ogv”
mime_type=“video/ogg”
case “.ogx”
mime_type=“font/otf”
case “.otf”
mime_type=“application/javascript”
case “.png”
mime_type=“image/png”
case “.pdf”
mime_type=“application/pdf”
case “.ppt”
mime_type=“application/vnd.ms-powerpoint”
case “.rar”
mime_type=“application/x-rar-compressed”
case “.rtf”
mime_type=“application/rtf”
case “.swf”
mime_type=“application/x-shockwave-flash”
case “.tar”
mime_type=“application/x-tar”
case “.tif”
mime_type=“image/tiff”
case “.tiff”
mime_type=“image/tiff”
case “.ttf”
mime_type=“font/ttf”
case “.vsd”
mime_type=“application/vnd.visio”
case “.wav”
mime_type=“audio/x-wav”
case “.weba”
mime_type=“audio/webm”
case “.webm”
mime_type=“video/webm”
case “.xhtml”
mime_type=“application/xhtml+xml”
case “.xls”
mime_type=“application/vnd.ms-excel”
case “.xlsx”
mime_type=“application/vnd.ms-excel”
case “.xml”
mime_type=“application/vnd.mozilla.xul+xml”
case “.zip”
mime_type=“application/zip”

end select[/code]

1 Like

bottom .js is duplicated
js is added 3 times.

xml: https://en.wikipedia.org/wiki/XML_and_MIME
use text/xml or application/xml

not any more :slight_smile:

Kind TIP:
or make external file which you will load later in array or dictionary.
with it then your easy adaptive for changes since types can be changed again by time and/or if you want to add some custom of… and after all, all what you need to update and change is external txt or xml or json kind file type without app code change.