Dateityp --> MIME

Übersicht BlitzBasic Codearchiv

Neue Antwort erstellen

Kryan

Betreff: Dateityp --> MIME

BeitragSa, Okt 14, 2006 10:34
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo,
hab mal was nettes nützliches programmiert (in guter Zusammenarbeit mit Powerprogrammer): Hiermit kann man herausfinden welcher mimetyp welchem dateityp entspricht, zum Beispiel

Print MIMEContentType("meine-datei.pdf") gibt "application/pdf" aus

Code: [AUSKLAPPEN]
;MIME-Replace
Function MIMEContentType$(txt$)
 Select Right$(txt$,2)
 Case ".z" Return "application/x-compress"
 End Select
 Select Right$(txt$,3)
 Case ".gz" Return "application/gzip"
 Case ".ai" Return "application/postscript"
 Case ".ps" Return "application/postscript"
 Case ".nc" Return "application/x-netcdf"
 Case ".sh" Return "application/x-sh"
 Case ".au" Return "audio/basic"
 Case ".es" Return "audio/echospeech"
 Case ".ra" Return "audio/x-pn-realaudio"
 Case ".js" Return "text/javascript"
 Case ".qt" Return "video/quicktime"
 End Select
 Select Right$(txt$,4)
 Case ".dwg" Return "application/acad"
 Case ".asd" Return "application/astound"
 Case ".asn" Return "application/astound"
 Case ".tsp" Return "application/dsptype"
 Case ".dxf" Return "application/dxf"
 Case ".spl" Return "application/futuresplash"
 Case ".hqx" Return "application/mac-binhex40"
 Case ".mbd" Return "application/mbedlet"
 Case ".mif" Return "application/mif"
 Case ".xls" Return "application/msexcel"
 Case ".xla" Return "application/msexcel"
 Case ".hlp" Return "application/mshelp"
 Case ".chm" Return "application/mshelp"
 Case ".ppt" Return "application/mspowerpoint"
 Case ".ppz" Return "application/mspowerpoint"
 Case ".pps" Return "application/mspowerpoint"
 Case ".pot" Return "application/mspowerpoint"
 Case ".doc" Return "application/msword"
 Case ".dot" Return "application/msword"
 Case ".bin" Return "application/octet-stream"
 Case ".exe" Return "application/octet-stream"
 Case ".com" Return "application/octet-stream"
 Case ".dll" Return "application/octet-stream"
 Case ".rar" Return "application/octet-stream"
 Case ".oda" Return "application/oda"
 Case ".pdf" Return "application/pdf"
 Case ".eps" Return "application/postscript"
 Case ".rtc" Return "application/rtc"
 Case ".rtf" Return "application/rtf"
 Case ".smp" Return "application/studiom"
 Case ".tbk" Return "application/toolbook"
 Case ".vmd" Return "application/vocaltec-media-desc"
 Case ".vmf" Return "application/vocaltec-media-file"
 Case ".htm" Return "application/xhtml+xml"
 Case ".xml" Return "application/xml"
 Case ".csh" Return "application/x-csh"
 Case ".dcr" Return "application/x-director"
 Case ".dir" Return "application/x-director"
 Case ".dxr" Return "application/x-director"
 Case ".dvi" Return "application/dvi"
 Case ".evy" Return "application/envoy"
 Case ".hdf" Return "application/x-hdf"
 Case ".php" Return "application/x-httpd-php"
 Case ".cdf" Return "application/x-netcdf"
 Case ".nsc" Return "application/x-nschat"
 Case ".swf" Return "application/x-shockwave-flash"
 Case ".cab" Return "application/x-shockwave-flash"
 Case ".spr" Return "application/x-sprite"
 Case ".sit" Return "application/x-stuffit"
 Case ".sca" Return "application/x-supercard"
 Case ".tar" Return "application/x-tar"
 Case ".tcl" Return "application/x-tcl"
 Case ".tex" Return "application/x-tex"
 Case ".src" Return "application/x-wais-source"
 Case ".zip" Return "application/zip"
 Case ".snd" Return "audio/basic"
 Case ".tsi" Return "audio/tsplayer"
 Case ".vox" Return "audio/voxware"
 Case ".aif" Return "audio/x-aiff"
 Case ".dus" Return "audio/x-dspeeh"
 Case ".cht" Return "audio/x-dspeeh"
 Case ".mid" Return "audio/x-midi"
 Case ".mp2" Return "audio/x-mpeg"
 Case ".ram" Return "audio/x-pn-realaudio"
 Case ".rpm" Return "audio/x-pn-realaudio-plugin"
 Case ".wav" Return "audio/x-wav"
 Case ".dwf" Return "drawing/x-dwf"
 Case ".cod" Return "image/cis-cod"
 Case ".ras" Return "image/cmu-raster"
 Case ".fif" Return "image/fif"
 Case ".gif" Return "image/gif"
 Case ".ief" Return "image/ief"
 Case ".jpg" Return "image/jpeg"
 Case ".jpe" Return "image/jpeg"
 Case ".png" Return "image/png"
 Case ".tif" Return "image/tiff"
 Case ".mcf" Return "image/vasa"
 Case ".fhc" Return "image/x-freehand"
 Case ".fh5" Return "image/x-freehand"
 Case ".fh4" Return "image/x-freehand"
 Case ".pbm" Return "image/x-portable-bitmap"
 Case ".pgm" Return "image/x-portable-graymap"
 Case ".ppm" Return "image/x-portable-pixmap"
 Case ".rgb" Return "image/x-rgb"
 Case ".xwd" Return "image/x-windowdump"
 Case ".xbm" Return "image/x-xbitmap"
 Case ".xpm" Return "image/x-xpixmap"
 Case ".wrl" Return "model/vrml"
 Case ".csv" Return "text/comma-separated-values"
 Case ".css" Return "text/css"
 Case ".htm" Return "text/html"
 Case ".txt" Return "text/plain"
 Case ".rtx" Return "text/richtext"
 Case ".rtf" Return "text/rtf"
 Case ".tsv" Return "text/tab-separated-values"
 Case ".wml" Return "text/vnd.wap.wml"
 Case ".xml" Return "text/xml"
 Case ".etx" Return "text/x-setext"
 Case ".sgm" Return "text/x-sgml"
 Case ".spc" Return "text/x-speech"
 Case ".mpe" Return "video/mpeg"
 Case ".mpg" Return "video/mpeg"
 Case ".mov" Return "video/quicktime"
 Case ".viv" Return "video/vnd.vivo"
 Case ".avi" Return "video/x-msvideo"
 Case ".vts" Return "workbook/formulaone"
 Case ".3dm" Return "x-world/x-3dmf"
 Case ".qd3" Return "x-world/x-3dmf"
 Case ".wrl" Return "x-world/x-vrml"
 End Select
 Select Right$(txt$,5)
 Case ".ptlk" Return "application/listenup"
 Case ".html" Return "application/xhtml+xml"
 Case ".cpio" Return "application/x-cpio"
 Case ".gtar" Return "application/x-gtar"
 Case ".shar" Return "application/x-shar"
 Case ".texi" Return "application/x-texinfo"
 Case ".aiff" Return "audio/x-aiff"
 Case ".aifc" Return "audio/x-aiff"
 Case ".midi" Return "audio/x-midi"
 Case ".jpeg" Return "image/jpeg"
 Case ".tiff" Return "image/tiff"
 Case ".wbmp" Return "image/vnd.wap.wbmp"
 Case ".html" Return "text/html"
 Case ".wmlc" Return "application/vnd.wap.wmlc"
 Case ".wmls" Return "text/vnd.wap.wmlscript"
 Case ".sgml" Return "text/x-sgml"
 Case ".talk" Return "text/x-speech"
 Case ".mpeg" Return "video/mpeg"
 Case ".vivo" Return "video/vnd.vivo"
 Case ".vtts" Return "workbook/formulaone"
 Case ".3dmf" Return "x-world/x-3dmf"
 Case ".qd3d" Return "x-world/x-3dmf"
 End Select
 Select Right$(txt$,6)
 Case ".class" Return "application/octet-stream"
 Case ".shtml" Return "application/xhtml+xml"
 Case ".xhtml" Return "application/xhtml+xml"
 Case ".bcpio" Return "application/x-bcpio"
 Case ".phtml" Return "application/x-httpd-php"
 Case ".latex" Return "application/x-latex"
 Case ".sprite" Return "application/x-sprite"
 Case ".ustar" Return "application/x-ustar"
 Case ".shtml" Return "text/html"
 Case ".wmlsc" Return "application/vnd.wap.wmlscriptc"
 Case ".movie" Return "video/x-sgi-movie"
 End Select
 Return "application/octet-stream"
End Function
Webspaceanbieter?
Klick hier!
Kultige Spieleschmiede?
Klick hier!

PowerProgrammer

BeitragSa, Okt 14, 2006 10:46
Antworten mit Zitat
Benutzer-Profile anzeigen
Wenn man sonen Code griffbereit hat, erleichtert einem das ganz schön die Arbeit.

Ich habe gerade das gefunden:
https://www.blitzforum.de/foru...hp?t=16031

Da hätten wir uns die Arbeit erleichtern können Embarassed Very Happy
www.xairro.com Alles für Webmaster und Programmierer! Es gibt mehr als bloß einen Counter!

Neue Antwort erstellen


Übersicht BlitzBasic Codearchiv

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group