User Tools

Site Tools


finding_20the_20mime_20type_20of_20a_20file

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

=====Finding the MIME type of a file===== //by Jon Ripley, May 2007//\\ \\ To read the MIME type of a file call "FN_GetMIMEType" passing it a file extension, for example:\\ PRINT "The MIME type of a .html file is ";FN_GetMIMEType("html") \\ The code for "FN_GetMIMEType" is:\\ DEF FN_GetMIMEType(T$) LOCAL B%, H%, L%, R%, T% L% = 255 : DIM B% LOCAL L% SYS "RegOpenKeyEx", &80000000, "."+T$, 0, &20001, ^H% TO R% IF R% = 0 THEN SYS "RegQueryValueEx", H%, "Content Type", 0, ^T%, B%, ^L% TO R% REM Uncomment the next line to set a default MIME type if none is found REM IF R% $$B% = MIMEDefault$ SYS "RegCloseKey", H% ENDIF = $$B% "FN_GetMIMEType" returns an empty string if no MIME type is found in the registry for the requested file extension. To set a default MIME type for all unknown extensions uncomment the specified line and replace **MIMEDefault$** with your fail safe type.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
finding_20the_20mime_20type_20of_20a_20file.1522502361.txt.gz · Last modified: 2018/03/31 14:19 by 127.0.0.1